Make first real commit: copy of CaRMetal 4.2.8
This commit is contained in:
parent
002acfc88e
commit
c312811084
1120 changed files with 226843 additions and 1 deletions
BIN
eric/JSprogram/.DS_Store
vendored
Normal file
BIN
eric/JSprogram/.DS_Store
vendored
Normal file
Binary file not shown.
1
eric/JSprogram/.cvsignore
Executable file
1
eric/JSprogram/.cvsignore
Executable file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
31
eric/JSprogram/Const.java
Normal file
31
eric/JSprogram/Const.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Const{
|
||||
public double BLA=3.5;
|
||||
public Const(){
|
||||
|
||||
}
|
||||
public double getBLA(){
|
||||
return BLA;
|
||||
}
|
||||
|
||||
public double m(String a,String b){
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
public double m(String a){
|
||||
return 2.0;
|
||||
}
|
||||
|
||||
}
|
31
eric/JSprogram/JSBlankIcon.java
Normal file
31
eric/JSprogram/JSBlankIcon.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class JSBlankIcon extends JButton{
|
||||
public JSBlankIcon(int size) {
|
||||
this.setBorder(BorderFactory.createEmptyBorder());
|
||||
fixsize(size);
|
||||
this.setContentAreaFilled(false);
|
||||
this.setOpaque(false);
|
||||
}
|
||||
|
||||
private void fixsize(final int sze) {
|
||||
final Dimension d=new Dimension(sze, sze);
|
||||
this.setMaximumSize(d);
|
||||
this.setMinimumSize(d);
|
||||
this.setPreferredSize(d);
|
||||
this.setSize(d);
|
||||
}
|
||||
}
|
144
eric/JSprogram/JSButton.java
Normal file
144
eric/JSprogram/JSButton.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.image.FilteredImageSource;
|
||||
import java.awt.image.ImageFilter;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GrayFilter;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
public class JSButton extends JButton implements MouseListener {
|
||||
|
||||
// private final ImageIcon myimage;
|
||||
int iconsize=24;
|
||||
boolean isEntered=false; // Mouseover ?
|
||||
boolean isDisabled;
|
||||
private String Name;
|
||||
|
||||
// String Shortcut;
|
||||
@Override
|
||||
public void paintComponent(final java.awt.Graphics g) {
|
||||
final java.awt.Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
if (g==null) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.paintComponent(g);
|
||||
final Graphics2D g2=(Graphics2D) g;
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
RenderingHints.VALUE_RENDER_QUALITY);
|
||||
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_PURE);
|
||||
if (isDisabled) {
|
||||
final ImageFilter filter=new GrayFilter(true, 60);
|
||||
final Image disImage=createImage(new FilteredImageSource(themes.getPaletteImage(Name).getSource(), filter));
|
||||
final ImageIcon myicn=new ImageIcon(disImage);
|
||||
g2.drawImage(myicn.getImage(), 0, 0, w, h, this);
|
||||
return;
|
||||
}
|
||||
//not elegant... just for one icon...
|
||||
if(Name.equals("monkey")){
|
||||
g2.drawImage(themes.resizeExistingIcon("/eric/GUI/icons/themes/common/monkeybtn_off.png", 22, 15).getImage(), 1, 4, 22, 15, this);
|
||||
} else {
|
||||
g2.drawImage(themes.getPaletteImage(Name), 0, 0, w, h, this);
|
||||
}
|
||||
|
||||
if (isEntered) {
|
||||
final AlphaComposite ac=AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 0.1f);
|
||||
g2.setComposite(ac);
|
||||
g2.setColor(new Color(0, 0, 80));
|
||||
final Stroke stroke=new BasicStroke(3f);
|
||||
g2.setStroke(stroke);
|
||||
g2.drawRect(1, 1, w-2, h-2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public JSButton(String name, int size,boolean enabled) {
|
||||
isDisabled=!enabled;
|
||||
iconsize=size;
|
||||
Name=name;
|
||||
this.setBorder(BorderFactory.createEmptyBorder());
|
||||
fixsize(iconsize);
|
||||
this.addMouseListener(this);
|
||||
this.setContentAreaFilled(false);
|
||||
this.setOpaque(false);
|
||||
this.setFocusable(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void fixsize(final int sze) {
|
||||
final Dimension d=new Dimension(sze, sze);
|
||||
this.setMaximumSize(d);
|
||||
this.setMinimumSize(d);
|
||||
this.setPreferredSize(d);
|
||||
this.setSize(d);
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
isEntered=true;
|
||||
repaint();
|
||||
|
||||
}
|
||||
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
isEntered=false;
|
||||
repaint();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
877
eric/JSprogram/JSEditor.form
Normal file
877
eric/JSprogram/JSEditor.form
Normal file
|
@ -0,0 +1,877 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[570, 120]"/>
|
||||
</Property>
|
||||
<Property name="undecorated" type="boolean" value="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[800, 600]"/>
|
||||
</Property>
|
||||
<Property name="size" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[800, 600]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
|
||||
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
|
||||
<EventHandler event="windowActivated" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowActivated"/>
|
||||
<EventHandler event="windowDeactivated" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowDeactivated"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,70,0,0,3,32"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[199, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseDragged" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="jPanel3MouseDragged"/>
|
||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanel3MousePressed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new myJTitleBar()"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="macpanel">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[523, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseDragged" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="macpanelMouseDragged"/>
|
||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="macpanelMousePressed"/>
|
||||
</Events>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="title_lbl">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="jLabel3"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 32767]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[45, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="closeBTN">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/themes/gray/zclosebutton.png"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="borderPainted" type="boolean" value="false"/>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
<Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/themes/gray/zclosebuttonover.png"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="closeBTNMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="winpanel">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[523, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseDragged" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="winpanelMouseDragged"/>
|
||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="winpanelMousePressed"/>
|
||||
</Events>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[565, 487]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="LeftBorder">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 32767]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 30]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 487]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new myJVerticalSeparatorPanel()"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel15">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[3, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[3, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[3, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="action_buttons">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32727, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[370, 40]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[350, 40]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JSlider" name="jTextHeight">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="DejaVu Sans" size="8" style="0"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="96" green="32" red="32" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="maximum" type="int" value="36"/>
|
||||
<Property name="minimum" type="int" value="9"/>
|
||||
<Property name="minorTickSpacing" type="int" value="1"/>
|
||||
<Property name="paintLabels" type="boolean" value="true"/>
|
||||
<Property name="paintTicks" type="boolean" value="true"/>
|
||||
<Property name="snapToTicks" type="boolean" value="true"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="script height"/>
|
||||
<Property name="value" type="int" value="16"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Curseur par défaut"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[96, 43]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jTextHeightStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel18">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="openbtn5">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/comment.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="Loc("JSEditor.comment")" type="code"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openbtn5MouseClicked"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openbtn5ActionPerformed"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="openbtn5KeyPressed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel16">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="openbtn2">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/format.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="Loc("JSeditor.format")" type="code"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openbtn2MouseClicked"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openbtn2ActionPerformed"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="openbtn2KeyPressed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel10">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="backbtn">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/restore.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="Loc("JSeditor.restore")" type="code"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="backbtnActionPerformed"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="backbtnKeyPressed"/>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="backbtnMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel11">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="openbtn3">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/run.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="Loc("JSeditor.run")" type="code"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openbtn3ActionPerformed"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="openbtn3KeyPressed"/>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openbtn3MouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel12">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="openbtn4">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/help.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="Loc("JSeditor.help")" type="code"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openbtn4ActionPerformed"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="openbtn4KeyPressed"/>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openbtn4MouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Curseur par défaut"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Properties>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Curseur par défaut"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextPane" name="script_area">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Monospaced" size="24" style="0"/>
|
||||
</Property>
|
||||
<Property name="caretColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="40" red="80" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Curseur de texte"/>
|
||||
</Property>
|
||||
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ec" green="96" red="9e" type="rgb"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="script_areaKeyTyped"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="script_areaKeyPressed"/>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="script_areaKeyReleased"/>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="script_areaMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel14">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 2]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 2]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 2]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="commands">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="cc" red="cc" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 98397]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 0]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 460]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="CaRMetal"/>
|
||||
<Property name="alignmentX" type="float" value="0.5"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="iconTextGap" type="int" value="0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="c_carmetal">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 230]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 100]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 230]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="horizontalGap" type="int" value="3"/>
|
||||
<Property name="verticalGap" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="c_js">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 360]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 260]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 260]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="Javascript"/>
|
||||
<Property name="alignmentX" type="float" value="0.5"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="iconTextGap" type="int" value="0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="js_btns">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 120]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 120]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 120]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="horizontalGap" type="int" value="3"/>
|
||||
<Property name="verticalGap" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
|
||||
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Lucida Grande" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 500]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 100]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 100]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="JSlist">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e5" green="dd" red="d6" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="DejaVu Sans" size="16" style="2"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="32" green="32" red="96" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new javax.swing.AbstractListModel() {
 String[] strings = { Global.Loc("JSFonctions.Input"), Global.Loc("JSFonctions.Print"), Global.Loc("JSFonctions.Println"), Global.Loc("JSFonctions.Alert"), Global.Loc("JSFonctions.ifelse"), Global.Loc("JSFonctions.switchcase"), Global.Loc("JSFonctions.for"), Global.Loc("JSFonctions.while"), Global.Loc("JSFonctions.dowhile"), Global.Loc("JSFonctions.dountil"),Global.Loc("JSFonctions.function") };
 public int getSize() { return strings.length; }
 public Object getElementAt(int i) { return strings[i]; }
 }" type="code"/>
|
||||
</Property>
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Curseur par défaut"/>
|
||||
</Property>
|
||||
<Property name="dragEnabled" type="boolean" value="true"/>
|
||||
<Property name="fixedCellHeight" type="int" value="20"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 415]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 200]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="visibleRowCount" type="int" value="-1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="JSlistValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="RightBorder">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 32767]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 0]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 515]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new myJVerticalSeparatorPanel()"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="controls">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32000, 22]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 22]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[35, 22]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new myStatusBarPanel()"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel13">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 1]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="errorpanel">
|
||||
<Properties>
|
||||
<Property name="alignmentX" type="float" value="0.0"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32737, 32737]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 30]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="errortitlelabel">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/jswindow/error.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Error"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="iconTextGap" type="int" value="10"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="errormessagelabel">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="68" green="70" red="75" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="DejaVu Sans" size="13" style="3"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="66" green="66" red="66" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Error message"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10000, 30]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/eric/GUI/icons/themes/gray/zoombox.png"/>
|
||||
</Property>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="borderPainted" type="boolean" value="false"/>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[25, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jButton2MouseClicked"/>
|
||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jButton2MousePressed"/>
|
||||
<EventHandler event="mouseDragged" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="jButton2MouseDragged"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
2977
eric/JSprogram/JSEditor.java
Normal file
2977
eric/JSprogram/JSEditor.java
Normal file
File diff suppressed because it is too large
Load diff
7815
eric/JSprogram/JSFunctions.java
Normal file
7815
eric/JSprogram/JSFunctions.java
Normal file
File diff suppressed because it is too large
Load diff
411
eric/JSprogram/JSIcon.java
Normal file
411
eric/JSprogram/JSIcon.java
Normal file
|
@ -0,0 +1,411 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.JComponent;
|
||||
import eric.JEricPanel;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.plaf.metal.MetalComboBoxUI;
|
||||
|
||||
public class JSIcon extends JSButton {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
String NAME;
|
||||
String CODE;
|
||||
ArrayList PATTERNS=new ArrayList();
|
||||
ArrayList STRS=new ArrayList();
|
||||
ArrayList VARS=new ArrayList();
|
||||
ArrayList CONST=new ArrayList();
|
||||
ArrayList EXEMPLES=new ArrayList();
|
||||
JSEditor JSC;
|
||||
private static final String REGEX_NUMERIC="(((?<=[-+*/(])|(?<=^))-)?\\d+(\\.\\d+)?";
|
||||
private static final String REGEX_VARIABLE="\\$[a-zA-Z][a-zA-Z0-9]*";
|
||||
public static final String REGEX_OPERATION="[a-zA-Z][a-zA-Z0-9]+|[-*/+|?:@&^<>'`=%#]";
|
||||
private static final String REGEX_PARANTHESIS="[()]";
|
||||
// private JPanel JPN=new JPanel();
|
||||
|
||||
private void fixsize(final int sze) {
|
||||
final Dimension d=new Dimension(sze, sze);
|
||||
this.setMaximumSize(d);
|
||||
this.setMinimumSize(d);
|
||||
this.setPreferredSize(d);
|
||||
this.setSize(d);
|
||||
}
|
||||
|
||||
// Create an Icon wich belongs to group (if not null) :
|
||||
// public JSIcon(final JSConsole jsc, final String nm, String[] codes) {
|
||||
public JSIcon(JSEditor jsc, String name, String code) {
|
||||
super(name, 24, !code.equals(""));
|
||||
JSC=jsc;
|
||||
NAME=name;
|
||||
CODE=code;
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!isDisabled) {
|
||||
JSC.clearStatusBar();
|
||||
if (e.getButton()!=MouseEvent.BUTTON3) {
|
||||
ClicOnMe();
|
||||
}
|
||||
JSC.NoTypeNoClic();
|
||||
}
|
||||
}
|
||||
});
|
||||
interpret();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
private int[] t;
|
||||
private int[] T;
|
||||
|
||||
private void interpret() {
|
||||
// exemple : <var,null>=Point(<name,null>,<nb,var,exp>,<nb,var,exp>);
|
||||
StringBuffer sb=new StringBuffer();
|
||||
Pattern p=Pattern.compile("<(\\w+[,\\w]*)>", Pattern.CASE_INSENSITIVE);
|
||||
Matcher m=p.matcher(CODE);
|
||||
while (m.find()) {
|
||||
VARS.add(m.group(1).split(","));
|
||||
m.appendReplacement(sb, "@@@@");
|
||||
}
|
||||
m.appendTail(sb);
|
||||
m.reset();
|
||||
String result=" "+sb.toString()+" ";
|
||||
String[] c=result.split("@@@@");
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i=0; i<c.length; i++) {
|
||||
CONST.add(c[i]);
|
||||
//CONST.add(c[i].trim());
|
||||
}
|
||||
f1();
|
||||
}
|
||||
|
||||
private void f1() {
|
||||
if (VARS.size()==0) {
|
||||
return;
|
||||
}
|
||||
t=new int[VARS.size()];
|
||||
T=new int[VARS.size()];
|
||||
for (int i=0; i<VARS.size(); i++) {
|
||||
T[i]=0;
|
||||
String[] col=(String[]) VARS.get(i);
|
||||
t[i]=col.length-1;
|
||||
}
|
||||
while (!arrayequal()) {
|
||||
|
||||
createPatterns();
|
||||
increment();
|
||||
}
|
||||
createPatterns();
|
||||
GenerateMoreEXEMPLES();
|
||||
// generateEXEMPLES();
|
||||
}
|
||||
|
||||
private void GenerateMoreEXEMPLES() {
|
||||
ArrayList moreexemple=new ArrayList();
|
||||
for (int i=0; i<EXEMPLES.size(); i++) {
|
||||
StringBuffer sb=new StringBuffer();
|
||||
Pattern p=Pattern.compile("<\"(\\w+[,\\w]*\\w+)\">", Pattern.CASE_INSENSITIVE);
|
||||
Matcher m=p.matcher((String) EXEMPLES.get(i));
|
||||
|
||||
if (m.find()) {
|
||||
String[] c=m.group(1).split(",");
|
||||
m.appendReplacement(sb, "@@@@");
|
||||
m.appendTail(sb);
|
||||
String myex=sb.toString();
|
||||
for (int k=0; k<c.length; k++) {
|
||||
if ((c[k].equals("true"))||(c[k].equals("false"))) {
|
||||
moreexemple.add(myex.replaceFirst("@@@@", c[k]));
|
||||
} else {
|
||||
|
||||
moreexemple.add(myex.replaceFirst("@@@@", "\""+c[k]+"\""));
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
moreexemple.add(EXEMPLES.get(i));
|
||||
}
|
||||
}
|
||||
EXEMPLES=moreexemple;
|
||||
}
|
||||
|
||||
private void createPatterns() {
|
||||
String st="";
|
||||
for (int m=0; m<T.length; m++) {
|
||||
// Vector col=(Vector) list.get(m);
|
||||
String[] col=(String[]) VARS.get(m);
|
||||
st+=(String) CONST.get(m)+"@"+col[T[m]]+"@";
|
||||
}
|
||||
|
||||
st+=(String) CONST.get(CONST.size()-1);
|
||||
st=st.trim();
|
||||
String mystr=
|
||||
st;
|
||||
|
||||
st=st.replace("(", "\\(");
|
||||
st=st.replace(")", "\\)");
|
||||
st=st.replace("@null@=", "");
|
||||
st=st.replace("@null@,", "");
|
||||
st=st.replace("@name@", "\"\\w*\"");
|
||||
st=st.replace("@exp@", "\"[^\"]+\"");
|
||||
st=st.replace("@nb@", "[a-zA-Z0-9\\.\\)\\(\\-*/+]+");
|
||||
st=st.replace("@var@", "\\w+");
|
||||
st=st.replace("@objs@", "\\w+,\\w+[,\\w+]*");
|
||||
// st="(;|\\n)\\s*"+st;
|
||||
|
||||
// System.out.println(mystr);
|
||||
try {
|
||||
PATTERNS.add(Pattern.compile(st, Pattern.CASE_INSENSITIVE));
|
||||
STRS.add(mystr);
|
||||
mystr=mystr.replace("@exp@,@nb@", "@exp@,@exp@");
|
||||
mystr=mystr.replace("@exp@,@var@", "@exp@,@exp@");
|
||||
mystr=mystr.replace("@nb@,@exp@", "@nb@,@nb@");
|
||||
mystr=mystr.replace("@nb@,@var@", "@nb@,@nb@");
|
||||
mystr=mystr.replace("@var@,@exp@", "@var@,@var@");
|
||||
mystr=mystr.replace("@var@,@nb@", "@var@,@var@");
|
||||
mystr=mystr.replace("@null@=", "");
|
||||
mystr=mystr.replace("@null@,", "");
|
||||
|
||||
// mystr=mystr.replace("@name@", code("name"));
|
||||
// mystr=mystr.replace("@exp@", code("exp"));
|
||||
// mystr=mystr.replace("@nb@", code("nb"));
|
||||
// mystr=mystr.replace("@var@", code("var"));
|
||||
if (!duplicateExemple(mystr)) {
|
||||
EXEMPLES.add(mystr);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// System.out.println("incorrect pattern syntax");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean duplicateExemple(String s) {
|
||||
for (int i=0; i<EXEMPLES.size(); i++) {
|
||||
String st=(String) EXEMPLES.get(i);
|
||||
if (st.equals(s)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void fixsize(final JComponent cp,
|
||||
final int w, final int h) {
|
||||
final Dimension d=
|
||||
new Dimension(w, h);
|
||||
cp.setMaximumSize(d);
|
||||
cp.setMinimumSize(d);
|
||||
cp.setPreferredSize(d);
|
||||
cp.setSize(d);
|
||||
}
|
||||
|
||||
static JEricPanel margin(final int w) {
|
||||
final JEricPanel mypan=
|
||||
new JEricPanel();
|
||||
fixsize(mypan, w, 1);
|
||||
mypan.setLayout(new javax.swing.BoxLayout(mypan,
|
||||
javax.swing.BoxLayout.X_AXIS));
|
||||
mypan.setAlignmentX(0F);
|
||||
mypan.setAlignmentY(0F);
|
||||
mypan.setOpaque(false);
|
||||
mypan.setFocusable(false);
|
||||
return mypan;
|
||||
}
|
||||
|
||||
class ItemAdapter implements ItemListener {
|
||||
|
||||
public void itemStateChanged(final ItemEvent evt) {
|
||||
if (evt.getStateChange()==ItemEvent.SELECTED) {
|
||||
JSC.addOrChange((String) evt.getItem());
|
||||
// if (doaction) {
|
||||
// final String menuitem=(String) evt.getItem();
|
||||
// doAction(menuitem);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class MyComboBoxUI extends MetalComboBoxUI {
|
||||
|
||||
public static MetalComboBoxUI createUI(final JComponent c) {
|
||||
return new MyComboBoxUI();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean arrayequal() {
|
||||
for (int m=0; m<T.length; m++) {
|
||||
if (t[m]!=T[m]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String code(String st) {
|
||||
if (st.equals("var")) {
|
||||
int car=(int) Math.floor(Math.random()*26);
|
||||
char a=(char) ("a".codePointAt(0)+car);
|
||||
return String.valueOf(a);
|
||||
} else if (st.equals("name")) {
|
||||
int car=(int) Math.floor(Math.random()*26);
|
||||
char a=(char) ("A".codePointAt(0)+car);
|
||||
return "\""+String.valueOf(a)+"\"";
|
||||
} else if (st.equals("nb")) {
|
||||
int i=(int) Math.round(Math.random()*10)-5;
|
||||
return ""+i;
|
||||
} else if (st.equals("exp")) {
|
||||
return "\"(x_a+x_b)/2\"";
|
||||
} else if (st.equals("objs")) {
|
||||
return "\"A,B,C\"";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private String replace(String s, String s1, String cod) {
|
||||
String mystr;
|
||||
while (!s.equals(mystr=s.replaceFirst("\\Q"+s1+"\\E", code(cod)))) {
|
||||
s=mystr;
|
||||
}
|
||||
|
||||
return mystr;
|
||||
}
|
||||
|
||||
public String exemple(
|
||||
int i) {
|
||||
if (i<EXEMPLES.size()) {
|
||||
String mystr=(String) EXEMPLES.get(i);
|
||||
mystr=replace(mystr, "@name@", "name");
|
||||
mystr=replace(mystr, "@exp@", "exp");
|
||||
mystr=replace(mystr, "@nb@", "nb");
|
||||
mystr=replace(mystr, "@var@", "var");
|
||||
mystr=replace(mystr, "@objs@", "objs");
|
||||
return mystr;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// public void generateEXEMPLES() {
|
||||
// for (int k=0; k<EXEMPLES.size(); k++) {
|
||||
// String mystr=(String) EXEMPLES.get(k);
|
||||
// mystr=replace(mystr, "@name@", "name");
|
||||
// mystr=replace(mystr, "@exp@", "exp");
|
||||
// mystr=replace(mystr, "@nb@", "nb");
|
||||
// mystr=replace(mystr, "@var@", "var");
|
||||
// mystr=replace(mystr, "@objs@", "objs");
|
||||
// EXEMPLES.set(k, mystr);
|
||||
// }
|
||||
// }
|
||||
public void increment() {
|
||||
int i=T.length-1;
|
||||
while ((T[i]==t[i])&&(i>0)) {
|
||||
T[i]=0;
|
||||
i=i-1;
|
||||
}
|
||||
|
||||
if (T[i]<t[i]) {
|
||||
T[i]++;
|
||||
}
|
||||
|
||||
}
|
||||
private int loop=0;
|
||||
|
||||
public void ClicOnMe() {
|
||||
// String st="";
|
||||
// if (EXEMPLES.size()>1) {
|
||||
// st=(String) EXEMPLES.get(0);
|
||||
// }
|
||||
JSC.addToScript(exemple(0));
|
||||
|
||||
|
||||
// String st="";
|
||||
//
|
||||
//
|
||||
//
|
||||
// for (int i=0; i<VARS.size(); i++) {
|
||||
// String[] col=(String[]) VARS.get(i);
|
||||
// st+=(String) CONST.get(i)+code(col[0]);
|
||||
// }
|
||||
// ;
|
||||
// st+=(String) CONST.get(CONST.size()-1);
|
||||
// st=st.trim();
|
||||
// JSC.addToScript(st);
|
||||
|
||||
|
||||
// JSC.addToScript("a=Point(\"A\",5,2);");
|
||||
|
||||
}
|
||||
|
||||
public ArrayList matches(
|
||||
JTextPane jta) {
|
||||
// System.out.println(NAME+" : "+PATTERNS.size());
|
||||
// String reg="\\w+=Point\\(\"\\w*\",[0-9]+,[0-9]+\\);";
|
||||
|
||||
// String reg="@var@=Point(@name@,@nb@,@nb@);";
|
||||
// reg=reg.replace("@var@", "\\w+");
|
||||
// reg=reg.replace("@name@", "\"\\w*\"");
|
||||
// reg=reg.replace("@nb@", "[0-9]+");
|
||||
// reg=reg.replace("(", "\\(");
|
||||
// reg=reg.replace(")", "\\)");
|
||||
// Pattern p=Pattern.compile(reg);
|
||||
// Matcher m=p.matcher(jta.getText());
|
||||
// if (m.find()) {return m.groupCount();}
|
||||
// return 0;
|
||||
ArrayList matchers=new ArrayList();
|
||||
|
||||
for (int i=0; i<PATTERNS.size(); i++) {
|
||||
Pattern p=(Pattern) PATTERNS.get(i);
|
||||
Matcher m=
|
||||
p.matcher(jta.getText());
|
||||
if (m.find()) {
|
||||
m.reset();
|
||||
matchers.add(m);
|
||||
}
|
||||
|
||||
}
|
||||
return matchers;
|
||||
}
|
||||
}
|
||||
|
||||
|
43
eric/JSprogram/JSOuputConsole.java
Normal file
43
eric/JSprogram/JSOuputConsole.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class JSOuputConsole extends JFrame {
|
||||
JTextArea textArea = new JTextArea();
|
||||
|
||||
public JSOuputConsole() {
|
||||
Font font = new Font("Verdana", Font.PLAIN, 16);
|
||||
textArea.setFont(font);
|
||||
textArea.setBackground(Color.WHITE);
|
||||
textArea.setForeground(Color.BLACK);
|
||||
|
||||
// Add a scrolling text area
|
||||
textArea.setEditable(false);
|
||||
textArea.setRows(10);
|
||||
textArea.setColumns(25);
|
||||
getContentPane().add(new JScrollPane(textArea), BorderLayout.CENTER);
|
||||
pack();
|
||||
setVisible(false);
|
||||
|
||||
// Create reader threads
|
||||
// new ReaderThread(piOut).start();
|
||||
}
|
||||
|
||||
public void print(String msg){
|
||||
textArea.append(msg);
|
||||
}
|
||||
|
||||
public void println(String msg){
|
||||
textArea.append(msg+"\n");//plus classique d'aller à la ligne après
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
253
eric/JSprogram/JScriptsLeftPanel.java
Normal file
253
eric/JSprogram/JScriptsLeftPanel.java
Normal file
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.window.myJMenuItem;
|
||||
import eric.JEricPanel;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreePath;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author PM
|
||||
*/
|
||||
public class JScriptsLeftPanel extends JEricPanel {
|
||||
private String path, SP = System.getProperty("file.separator");
|
||||
private File ScriptsDirectory = new File(Global.getHomeDirectory()+"scripts");
|
||||
private DefaultMutableTreeNode myRoot;
|
||||
private JTree ScriptsTree = null;
|
||||
private ArrayList<String> ToolTip = new ArrayList<String>(), FileName = new ArrayList<String>();
|
||||
private ScriptItemsArray items=new ScriptItemsArray();
|
||||
private JScrollPane jsp;
|
||||
|
||||
public JScriptsLeftPanel(){
|
||||
this.setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
myRoot = new DefaultMutableTreeNode("CaRScripts");
|
||||
explore(ScriptsDirectory, myRoot);
|
||||
|
||||
ScriptsTree = new JTree(myRoot);
|
||||
ToolTipManager.sharedInstance().registerComponent(ScriptsTree);
|
||||
ScriptsTree.setCellRenderer(new MyRenderer());
|
||||
|
||||
MouseListener ml = new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
int row = ScriptsTree.getRowForLocation(e.getX(), e.getY());
|
||||
TreePath TPath = ScriptsTree.getPathForLocation(e.getX(), e.getY());
|
||||
ScriptsTree.setSelectionRow(row);
|
||||
if(row != -1 && e.isMetaDown()) {
|
||||
path = Global.getHomeDirectory()+"scripts";
|
||||
for(int i=1; i<TPath.getPathCount(); i++){
|
||||
path += SP;
|
||||
path += TPath.getPathComponent(i);
|
||||
}
|
||||
myPopUpMenu(path, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ScriptsTree.addMouseListener(ml);
|
||||
|
||||
jsp = new JScrollPane(ScriptsTree);
|
||||
jsp.setBorder(javax.swing.BorderFactory.createEmptyBorder());
|
||||
this.add(jsp);
|
||||
}
|
||||
|
||||
public void fixPanelSize(final int w, final int h) {
|
||||
Dimension d = new Dimension(w, h);
|
||||
|
||||
this.setMaximumSize(d);
|
||||
this.setMinimumSize(d);
|
||||
this.setPreferredSize(d);
|
||||
this.setSize(d);
|
||||
|
||||
jsp.setSize(d);
|
||||
jsp.revalidate();
|
||||
}
|
||||
|
||||
class MyRenderer extends DefaultTreeCellRenderer {
|
||||
private int j;
|
||||
public MyRenderer() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus) {
|
||||
|
||||
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
|
||||
if(row !=-1){
|
||||
if (leaf) {
|
||||
for(j=0; j<FileName.size() && !FileName.get(j).equals(value.toString()); j++){}
|
||||
if(j<ToolTip.size()){
|
||||
setToolTipText(ToolTip.get(j));
|
||||
}
|
||||
} else {
|
||||
setToolTipText(null);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
final public void explore(File folder, DefaultMutableTreeNode myRoot){
|
||||
File[] f = folder.listFiles();
|
||||
ToolTip.add("");
|
||||
FileName.add("Folder");
|
||||
|
||||
for(File file :f){
|
||||
DefaultMutableTreeNode childNode;
|
||||
if(file.isDirectory() && file.listFiles().length!=0){
|
||||
childNode = new DefaultMutableTreeNode(file.toString().substring(file.toString().lastIndexOf(SP)+1));
|
||||
myRoot.add(childNode);
|
||||
explore(file, childNode);
|
||||
} else if(file.toString().endsWith(".js")) {
|
||||
childNode = new DefaultMutableTreeNode(file.toString().substring(file.toString().lastIndexOf(SP)+1));
|
||||
myRoot.add(childNode);
|
||||
ToolTip.add(getToolTip(file, childNode.toString()));
|
||||
FileName.add(childNode.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final String getToolTip(File file, String ScriptName){
|
||||
String str="";
|
||||
String mystr="<html><b>"+ScriptName+"</b><br/>";
|
||||
try {
|
||||
InputStream input = new FileInputStream(file);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(input, "UTF-8"));
|
||||
while((str=in.readLine())!=null && !(str=str.trim()).endsWith("//end")) {
|
||||
//str=str.trim();
|
||||
mystr += str.replace("//", "");
|
||||
mystr += "<br/>";
|
||||
}
|
||||
} catch(Exception ex){}
|
||||
return mystr+"</html>";
|
||||
}
|
||||
|
||||
/*
|
||||
* menu popup et les méthodes attachées
|
||||
* aux différents items
|
||||
*/
|
||||
private void myPopUpMenu(final String path, final MouseEvent e){
|
||||
JMenuItem item, runitem, includeFileItem, includeFolderItem;
|
||||
JPopupMenu myPopUpMenu = new JPopupMenu();
|
||||
|
||||
// add Cancel Item :
|
||||
item = new myJMenuItem(Global.Loc("JSmenu.cancel"), themes.resizeExistingIcon("/eric/GUI/icons/jswindow/restore.png", 16, 16));
|
||||
item.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
JZirkelCanvas.getCurrentZC().getScriptsPanel().Restore();
|
||||
}
|
||||
});
|
||||
item.setEnabled(JZirkelCanvas.getCurrentZC().getScriptsPanel().isBackup());
|
||||
myPopUpMenu.add(item);
|
||||
|
||||
// add Run Item
|
||||
runitem = new myJMenuItem("Exécuter", themes.resizeExistingIcon("/eric/GUI/icons/jswindow/run.png", 12, 16));
|
||||
runitem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
run(new File(path));
|
||||
}
|
||||
});
|
||||
|
||||
// to include this file
|
||||
includeFileItem=new myJMenuItem("Inclure dans la figure");
|
||||
includeFileItem.addActionListener(new ActionListener(){
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
include(path);
|
||||
}
|
||||
});
|
||||
|
||||
//to include all scripts in this folder
|
||||
includeFolderItem = new myJMenuItem("Inclure le dossier dans la figure");
|
||||
includeFolderItem.addActionListener(new ActionListener(){
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
includeFolder(new File(path));
|
||||
}
|
||||
});
|
||||
|
||||
if((new File(path)).isDirectory()){
|
||||
myPopUpMenu.add(includeFolderItem);
|
||||
} else {
|
||||
myPopUpMenu.add(runitem);
|
||||
myPopUpMenu.add(includeFileItem);
|
||||
}
|
||||
|
||||
myPopUpMenu.show(e.getComponent(), e.getX()+15, e.getY());
|
||||
}
|
||||
|
||||
public void run(File file){
|
||||
String str="";
|
||||
String mystr="";
|
||||
try {
|
||||
InputStream input=new FileInputStream(file);
|
||||
BufferedReader in=new BufferedReader(new InputStreamReader(input, "UTF-8"));
|
||||
while ((str=in.readLine())!=null) {
|
||||
str=str.trim();
|
||||
mystr+=str+"\n";
|
||||
}
|
||||
} catch(Exception ex){}
|
||||
|
||||
ScriptItem si = new ScriptItem(null, "anonymous", mystr);
|
||||
items.add(si);
|
||||
si.runScript();
|
||||
}
|
||||
|
||||
public void include(String path){
|
||||
JZirkelCanvas.getCurrentZC().openScriptFile(path, false);
|
||||
}
|
||||
|
||||
public void includeFolder(File folder){
|
||||
File[] f = folder.listFiles();
|
||||
for(File file : f){
|
||||
if(file.toString().endsWith(".js")){
|
||||
include(file.toString());
|
||||
} else if(file.isDirectory()){
|
||||
includeFolder(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Scripts lancés depuis le panneau de gauche
|
||||
*/
|
||||
|
||||
public ScriptItemsArray getScripts(){
|
||||
return items;
|
||||
}
|
||||
}
|
133
eric/JSprogram/LineNumber.java
Normal file
133
eric/JSprogram/LineNumber.java
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
|
||||
|
||||
|
||||
//package text;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.text.*;
|
||||
public class LineNumber extends JComponent {
|
||||
// private final static Color DEFAULT_BACKGROUND = new Color(235, 230, 225);
|
||||
private final static Color DEFAULT_BACKGROUND = new Color(14, 221, 29);
|
||||
private final static Color DEFAULT_FOREGROUND = Color.black;
|
||||
private final static Font DEFAULT_FONT = new Font("monospaced", Font.PLAIN, 12);
|
||||
// LineNumber height (abends when I use MAX_VALUE)
|
||||
private final static int HEIGHT = Integer.MAX_VALUE - 1000000;
|
||||
// Set right/left margin
|
||||
private final static int MARGIN = 5;
|
||||
// Variables for this LineNumber component
|
||||
private FontMetrics fontMetrics;
|
||||
private int lineHeight;
|
||||
private int currentDigits;
|
||||
// Metrics of the component used in the constructor
|
||||
private JComponent component;
|
||||
private int componentFontHeight;
|
||||
private int componentFontAscent;
|
||||
/**
|
||||
* Convenience constructor for Text Components
|
||||
*/
|
||||
public LineNumber(JComponent component) {
|
||||
if (component == null) {
|
||||
setFont( DEFAULT_FONT );
|
||||
this.component = this;
|
||||
} else {
|
||||
setFont( component.getFont() );
|
||||
this.component = component;
|
||||
}
|
||||
setBackground( DEFAULT_BACKGROUND );
|
||||
setForeground( DEFAULT_FOREGROUND );
|
||||
setPreferredWidth( 99 );
|
||||
}
|
||||
/**
|
||||
* Calculate the width needed to display the maximum line number
|
||||
*/
|
||||
public void setPreferredWidth(int lines) {
|
||||
int digits = String.valueOf(lines).length();
|
||||
// Update sizes when number of digits in the line number changes
|
||||
if (digits != currentDigits && digits > 1) {
|
||||
currentDigits = digits;
|
||||
int width = fontMetrics.charWidth( '0' ) * digits;
|
||||
Dimension d = getPreferredSize();
|
||||
d.setSize(2 * MARGIN + width, HEIGHT);
|
||||
setPreferredSize( d );
|
||||
setSize( d );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reset variables that are dependent on the font.
|
||||
*/
|
||||
public void setFont(Font font) {
|
||||
super.setFont(font);
|
||||
fontMetrics = getFontMetrics( getFont() );
|
||||
componentFontHeight = fontMetrics.getHeight();
|
||||
componentFontAscent = fontMetrics.getAscent();
|
||||
}
|
||||
/**
|
||||
* The line height defaults to the line height of the font for this
|
||||
* component.
|
||||
*/
|
||||
public int getLineHeight() {
|
||||
if (lineHeight == 0)
|
||||
return componentFontHeight;
|
||||
else
|
||||
return lineHeight;
|
||||
}
|
||||
/**
|
||||
* Override the default line height with a positive value.
|
||||
* For example, when you want line numbers for a JTable you could
|
||||
* use the JTable row height.
|
||||
*/
|
||||
public void setLineHeight(int lineHeight) {
|
||||
if (lineHeight > 0)
|
||||
this.lineHeight = lineHeight;
|
||||
}
|
||||
public int getStartOffset() {
|
||||
return component.getInsets().top + componentFontAscent;
|
||||
}
|
||||
public void paintComponent(Graphics g) {
|
||||
int lineHeight = getLineHeight();
|
||||
int startOffset = getStartOffset();
|
||||
Rectangle drawHere = g.getClipBounds();
|
||||
// Paint the background
|
||||
g.setColor( getBackground() );
|
||||
g.fillRect(drawHere.x, drawHere.y, drawHere.width, drawHere.height);
|
||||
// Determine the number of lines to draw in the foreground.
|
||||
g.setColor( getForeground() );
|
||||
int startLineNumber = (drawHere.y / lineHeight) + 1;
|
||||
int endLineNumber = startLineNumber + (drawHere.height / lineHeight);
|
||||
int start = (drawHere.y / lineHeight) * lineHeight + startOffset;
|
||||
for (int i = startLineNumber; i <= endLineNumber; i++) {
|
||||
String lineNumber = String.valueOf(i);
|
||||
int stringWidth = fontMetrics.stringWidth( lineNumber );
|
||||
int rowWidth = getSize().width;
|
||||
g.drawString(lineNumber, rowWidth - stringWidth - MARGIN, start);
|
||||
start += lineHeight;
|
||||
}
|
||||
int rows = component.getSize().height / componentFontHeight;
|
||||
setPreferredWidth( rows );
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
JFrame frame = new JFrame("LineNumberDemo");
|
||||
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
|
||||
JPanel panel = new JPanel();
|
||||
frame.setContentPane( panel );
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
|
||||
panel.setLayout(new BorderLayout());
|
||||
JTextArea textPane = new JTextArea();
|
||||
textPane.setFont( new Font("monospaced", Font.PLAIN, 12) );
|
||||
textPane.setText("abc");
|
||||
JScrollPane scrollPane = new JScrollPane(textPane);
|
||||
panel.add(scrollPane);
|
||||
scrollPane.setPreferredSize(new Dimension(300, 250));
|
||||
LineNumber lineNumber = new LineNumber( textPane );
|
||||
scrollPane.setRowHeaderView(lineNumber );
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
330
eric/JSprogram/LineNumberView.java
Normal file
330
eric/JSprogram/LineNumberView.java
Normal file
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.SizeSequence;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
import javax.swing.text.JTextComponent;
|
||||
//import eric.JSprogram.JSConsole;
|
||||
|
||||
/**
|
||||
* LineNumberView is a simple line-number gutter that works correctly
|
||||
* even when lines are wrapped in the associated text component. This
|
||||
* is meant to be used as the RowHeaderView in a JScrollPane that
|
||||
* contains the associated text component. Example usage:
|
||||
*<pre>
|
||||
* JTextArea ta = new JTextArea();
|
||||
* ta.setLineWrap(true);
|
||||
* ta.setWrapStyleWord(true);
|
||||
* JScrollPane sp = new JScrollPane(ta);
|
||||
* sp.setRowHeaderView(new LineNumberView(ta));
|
||||
*</pre>
|
||||
*
|
||||
* @author Alan Moore
|
||||
*/
|
||||
public class LineNumberView extends JComponent
|
||||
{
|
||||
// This is for the border to the right of the line numbers.
|
||||
// There's probably a UIDefaults value that could be used for this.
|
||||
private static final Color BORDER_COLOR = Color.GRAY;
|
||||
private final static Color DEFAULT_BACKGROUND = new Color(214, 221, 229);
|
||||
private final static Color DEFAULT_FOREGROUND = Color.black;
|
||||
|
||||
private static final int WIDTH_TEMPLATE = 99999;
|
||||
private static final int MARGIN = 2;
|
||||
|
||||
private FontMetrics viewFontMetrics;
|
||||
private int maxNumberWidth;
|
||||
private int componentWidth;
|
||||
|
||||
private int textTopInset;
|
||||
private int textFontAscent;
|
||||
private int textFontHeight;
|
||||
|
||||
private JTextComponent text;
|
||||
private SizeSequence sizes;
|
||||
private int startLine = 0;
|
||||
private boolean structureChanged = true;
|
||||
|
||||
/**
|
||||
* Construct a LineNumberView and attach it to the given text component.
|
||||
* The LineNumberView will listen for certain kinds of events from the
|
||||
* text component and update itself accordingly.
|
||||
*
|
||||
* @param startLine the line that changed, if there's only one
|
||||
* @param structureChanged if <tt>true</tt>, ignore the line number and
|
||||
* update all the line heights.
|
||||
*/
|
||||
public LineNumberView(JTextComponent text)
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Text component cannot be null");
|
||||
}
|
||||
this.text = text;
|
||||
updateCachedMetrics();
|
||||
|
||||
UpdateHandler handler = new UpdateHandler();
|
||||
text.getDocument().addDocumentListener(handler);
|
||||
text.addPropertyChangeListener(handler);
|
||||
text.addComponentListener(handler);
|
||||
|
||||
// setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
|
||||
setBorder(BorderFactory.createEmptyBorder());
|
||||
setBackground(DEFAULT_BACKGROUND);
|
||||
setForeground(DEFAULT_FOREGROUND) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule a repaint because one or more line heights may have changed.
|
||||
*
|
||||
* @param startLine the line that changed, if there's only one
|
||||
* @param structureChanged if <tt>true</tt>, ignore the line number and
|
||||
* update all the line heights.
|
||||
*/
|
||||
private void viewChanged(int startLine, boolean structureChanged)
|
||||
{
|
||||
this.startLine = startLine;
|
||||
this.structureChanged = structureChanged;
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
/** Update the line heights as needed. */
|
||||
private void updateSizes()
|
||||
{
|
||||
if (startLine < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (structureChanged)
|
||||
{
|
||||
int count = getAdjustedLineCount();
|
||||
sizes = new SizeSequence(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
sizes.setSize(i, getLineHeight(i));
|
||||
}
|
||||
structureChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizes.setSize(startLine, getLineHeight(startLine));
|
||||
}
|
||||
|
||||
startLine = -1;
|
||||
}
|
||||
|
||||
/* Copied from javax.swing.text.PlainDocument */
|
||||
private int getAdjustedLineCount()
|
||||
{
|
||||
// There is an implicit break being modeled at the end of the
|
||||
// document to deal with boundary conditions at the end. This
|
||||
// is not desired in the line count, so we detect it and remove
|
||||
// its effect if throwing off the count.
|
||||
Element map = text.getDocument().getDefaultRootElement();
|
||||
int n = map.getElementCount();
|
||||
Element lastLine = map.getElement(n - 1);
|
||||
if ((lastLine.getEndOffset() - lastLine.getStartOffset()) > 1)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
|
||||
return n - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of a line from the JTextComponent.
|
||||
*
|
||||
* @param index the line number
|
||||
* @param the height, in pixels
|
||||
*/
|
||||
private int getLineHeight(int index)
|
||||
{
|
||||
int lastPos = sizes.getPosition(index) + textTopInset;
|
||||
int height = textFontHeight;
|
||||
try
|
||||
{
|
||||
Element map = text.getDocument().getDefaultRootElement();
|
||||
int lastChar = map.getElement(index).getEndOffset() - 1;
|
||||
Rectangle r = text.modelToView(lastChar);
|
||||
height = (r.y - lastPos) + r.height;
|
||||
}
|
||||
catch (BadLocationException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache some values that are used a lot in painting or size
|
||||
* calculations. Also ensures that the line-number font is not
|
||||
* larger than the text component's font (by point-size, anyway).
|
||||
*/
|
||||
private void updateCachedMetrics()
|
||||
{
|
||||
Font textFont = text.getFont();
|
||||
FontMetrics fm = getFontMetrics(textFont);
|
||||
textFontHeight = Math.max(fm.getHeight(),10);
|
||||
textFontHeight = JSEditor.TailleTexte; //private donc inaccessible ici, dommage...
|
||||
textFontAscent = fm.getAscent();
|
||||
textTopInset = text.getInsets().top;
|
||||
|
||||
Font viewFont = getFont();
|
||||
boolean changed = false;
|
||||
if (viewFont == null)
|
||||
{
|
||||
viewFont = UIManager.getFont("Label.font");
|
||||
changed = true;
|
||||
}
|
||||
if (viewFont.getSize() != textFont.getSize())
|
||||
{
|
||||
viewFont = viewFont.deriveFont(textFont.getSize2D());
|
||||
changed = true;
|
||||
}
|
||||
|
||||
viewFontMetrics = getFontMetrics(viewFont);
|
||||
maxNumberWidth = (viewFontMetrics.stringWidth(String.valueOf(WIDTH_TEMPLATE))+10)/2;
|
||||
componentWidth = 2 * MARGIN + maxNumberWidth;
|
||||
|
||||
if (changed)
|
||||
{
|
||||
super.setFont(viewFont);
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize()
|
||||
{
|
||||
return new Dimension(componentWidth, text.getHeight());
|
||||
}
|
||||
|
||||
public void setFont(Font font)
|
||||
{
|
||||
super.setFont(font);
|
||||
updateCachedMetrics();
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
updateSizes();
|
||||
Rectangle clip = g.getClipBounds();
|
||||
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(clip.x, clip.y, clip.width, clip.height);
|
||||
|
||||
g.setColor(getForeground());
|
||||
int base = clip.y - textTopInset;
|
||||
int first = sizes.getIndex(base);
|
||||
int last = sizes.getIndex(base + clip.height);
|
||||
String text = "";
|
||||
|
||||
for (int i = first; i <= last; i++)
|
||||
{
|
||||
text = String.valueOf(i+1);
|
||||
int x = MARGIN + maxNumberWidth - viewFontMetrics.stringWidth(text);
|
||||
int y = sizes.getPosition(i) + textFontAscent + textTopInset;
|
||||
g.drawString(text, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
class UpdateHandler extends ComponentAdapter
|
||||
implements PropertyChangeListener, DocumentListener
|
||||
{
|
||||
/**
|
||||
* The text component was resized. 'Nuff said.
|
||||
*/
|
||||
public void componentResized(ComponentEvent evt)
|
||||
{
|
||||
viewChanged(0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* A bound property was changed on the text component. Properties
|
||||
* like the font, border, and tab size affect the layout of the
|
||||
* whole document, so we invalidate all the line heights here.
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
Object oldValue = evt.getOldValue();
|
||||
Object newValue = evt.getNewValue();
|
||||
String propertyName = evt.getPropertyName();
|
||||
if ("document".equals(propertyName))
|
||||
{
|
||||
if (oldValue != null && oldValue instanceof Document)
|
||||
{
|
||||
((Document)oldValue).removeDocumentListener(this);
|
||||
}
|
||||
if (newValue != null && newValue instanceof Document)
|
||||
{
|
||||
((Document)newValue).addDocumentListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
updateCachedMetrics();
|
||||
viewChanged(0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text was inserted into the document.
|
||||
*/
|
||||
public void insertUpdate(DocumentEvent evt)
|
||||
{
|
||||
update(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text was removed from the document.
|
||||
*/
|
||||
public void removeUpdate(DocumentEvent evt)
|
||||
{
|
||||
update(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text attributes were changed. In a source-code editor based on
|
||||
* StyledDocument, attribute changes should be applied automatically
|
||||
* in response to inserts and removals. Since we're already
|
||||
* listening for those, this method should be redundant, but YMMV.
|
||||
*/
|
||||
public void changedUpdate(DocumentEvent evt)
|
||||
{
|
||||
// update(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the edit was confined to a single line, invalidate that
|
||||
* line's height. Otherwise, invalidate them all.
|
||||
*/
|
||||
private void update(DocumentEvent evt)
|
||||
{
|
||||
Element map = text.getDocument().getDefaultRootElement();
|
||||
int line = map.getElementIndex(evt.getOffset());
|
||||
DocumentEvent.ElementChange ec = evt.getChange(map);
|
||||
viewChanged(line, ec != null);
|
||||
}
|
||||
}
|
||||
}
|
487
eric/JSprogram/ScriptItem.java
Normal file
487
eric/JSprogram/ScriptItem.java
Normal file
|
@ -0,0 +1,487 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.ZDialog.ZTextFieldAndLabel;
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import eric.controls.JCanvasPanel;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import rene.gui.Global;
|
||||
import rene.util.FileName;
|
||||
import rene.util.xml.XmlTree;
|
||||
import rene.util.xml.XmlWriter;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
import rene.zirkel.objects.ConstructionObject;
|
||||
import rene.zirkel.tools.Scripts_SetMouseDrag;
|
||||
//import rene.zirkel.tools.Scripts_SetMouseOver;
|
||||
import rene.zirkel.tools.Scripts_SetMouseUp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ScriptItem extends JMenuItem implements ActionListener {
|
||||
|
||||
private String name, source;
|
||||
private boolean executeOnLoad=false;
|
||||
private ArrayList<ConstructionObject> mouseDragEventTargets=new ArrayList<ConstructionObject>();
|
||||
private ArrayList<ConstructionObject> mouseUpEventTargets=new ArrayList<ConstructionObject>();
|
||||
private ArrayList<ConstructionObject> mouseOverEventTargets=new ArrayList<ConstructionObject>();
|
||||
private ScriptThread THREAD=null;
|
||||
private ZTextFieldAndLabel currentInputField=null, otherInputField = null;
|
||||
private String mouseDragTargetsNames="", mouseUpTargetsNames=""; // Attention, champs intermédiaire pour le load, ne reflète pas toujours la réalité
|
||||
// private String mouseOverTargetsNames="";
|
||||
private JSEditor JSC=null;
|
||||
private String FILENAME="";
|
||||
private ScriptPanel PANEL;
|
||||
|
||||
public ScriptItem(ScriptPanel panel, XmlTree tree) {
|
||||
super(tree.getTag().getValue("Name"));
|
||||
PANEL=panel;
|
||||
name=tree.getTag().getValue("Name");
|
||||
if (tree.getTag().hasParam("mousedrag")) {
|
||||
mouseDragTargetsNames=tree.getTag().getValue("mousedrag");
|
||||
}
|
||||
if (tree.getTag().hasParam("mouseup")) {
|
||||
mouseUpTargetsNames=tree.getTag().getValue("mouseup");
|
||||
}
|
||||
executeOnLoad=tree.getTag().hasTrueParam("onload");
|
||||
source=tree.getText();
|
||||
source=source.replaceAll("^[\n]*", "");
|
||||
source=source.replace("<", "<");
|
||||
source=source.replace(">", ">");
|
||||
addActionListener(this);
|
||||
setFont(themes.TabMenusFont);
|
||||
}
|
||||
|
||||
public ScriptItem(ScriptPanel panel, String scriptname, String scriptsource) {
|
||||
super(scriptname);
|
||||
PANEL=panel;
|
||||
name=scriptname;
|
||||
source=scriptsource;
|
||||
addActionListener(this);
|
||||
setFont(themes.TabMenusFont);
|
||||
}
|
||||
|
||||
public ScriptPanel getPanel() {
|
||||
return PANEL;
|
||||
}
|
||||
|
||||
public void setExecuteOnLoad(boolean b) {
|
||||
executeOnLoad=b;
|
||||
}
|
||||
|
||||
public boolean getExecuteOnLoad() {
|
||||
return executeOnLoad;
|
||||
}
|
||||
|
||||
public void setFileName(String name) {
|
||||
FILENAME=name;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return FILENAME;
|
||||
}
|
||||
|
||||
public String getScriptName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getScriptSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setScriptName(String s) {
|
||||
name=s;
|
||||
}
|
||||
|
||||
public void setScriptSource(String s) {
|
||||
source=s;
|
||||
}
|
||||
|
||||
public void setEditor(JSEditor jse){
|
||||
JSC=jse;
|
||||
}
|
||||
|
||||
public JSEditor getEditor() {
|
||||
return JSC;
|
||||
}
|
||||
|
||||
public void openEditor() {
|
||||
if (JSC==null) {
|
||||
JSC=new JSEditor(this);
|
||||
} else {
|
||||
JSC.setVisible(true);
|
||||
JSC.toFront();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeEditor() {
|
||||
if (JSC!=null) {
|
||||
JSC.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean unique(String s, ScriptItemsArray V) {
|
||||
for (ScriptItem myItem : V) {
|
||||
if (s.equals(myItem.getScriptName())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String uniqueScriptName(String base) {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc==null) {
|
||||
return base;
|
||||
}
|
||||
ScriptItemsArray V=zc.getScripts();
|
||||
if (!unique(base, V)) {
|
||||
int num=0;
|
||||
do {
|
||||
num++;
|
||||
base=base.replaceAll("[\\s0-9]+$", "")+" "+num;
|
||||
} while (!unique(base, V));
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
public void newScriptInConstruction() {
|
||||
openEditor();
|
||||
String s="";
|
||||
do {
|
||||
s=(String) JOptionPane.showInputDialog(
|
||||
JSC,
|
||||
Global.Loc("JSeditor.saveinfig.question"),
|
||||
Global.Loc("JSeditor.saveinfig.title"),
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null,
|
||||
null,
|
||||
"");
|
||||
} while ("".equals(s));
|
||||
s=uniqueScriptName(s);
|
||||
JSC.setWindowTitle(Global.Loc("JSeditor.infig")+s);
|
||||
JSC.setScriptName(s);
|
||||
setScriptName(s);
|
||||
}
|
||||
|
||||
public void openScriptFile(final String myname, boolean open) {
|
||||
String str="";
|
||||
String mystr="";
|
||||
try {
|
||||
InputStream input=new FileInputStream(myname);
|
||||
BufferedReader in=new BufferedReader(new InputStreamReader(input, "UTF-8"));
|
||||
while ((str=in.readLine())!=null) {
|
||||
str=str.trim();
|
||||
mystr+=str+"\n";
|
||||
}
|
||||
source=mystr;
|
||||
name=FileName.filename(myname);
|
||||
if(open)
|
||||
openEditor();
|
||||
JSC.setScriptArea(source);
|
||||
JSC.setWindowTitle(Global.Loc("JSeditor.infig")+name);
|
||||
JSC.setScriptName(name);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void openEmbeddedScript() {
|
||||
openEditor();
|
||||
JSC.setScriptArea(source);
|
||||
JSC.setWindowTitle(Global.Loc("JSeditor.infig")+name);
|
||||
JSC.setScriptName(name);
|
||||
}
|
||||
|
||||
public void sendErrorToEditor(String message) {
|
||||
openEditor();
|
||||
JSC.setScriptArea(source);
|
||||
JSC.setWindowTitle(FILENAME);
|
||||
JSC.Error(message);
|
||||
}
|
||||
|
||||
public void fixMouseTargets() {
|
||||
setMouseDragTargets(mouseDragTargetsNames);
|
||||
setMouseUpTargets(mouseUpTargetsNames);
|
||||
// setMouseOverTargets(mouseOverTargetsNames);
|
||||
}
|
||||
|
||||
public void saveScript(final XmlWriter xml) {
|
||||
xml.startTagStart("Script");
|
||||
xml.printArg("Name", name);
|
||||
if(mouseDragEventTargets.size()>0) {
|
||||
xml.printArg("mousedrag", getMouseDragTargetNames());
|
||||
}
|
||||
if(mouseUpEventTargets.size()>0) {
|
||||
xml.printArg("mouseup", getMouseUpTargetNames());
|
||||
}
|
||||
xml.printArg("onload", ""+executeOnLoad);
|
||||
xml.startTagEndNewLine();
|
||||
xml.print(source);
|
||||
//xml.println();
|
||||
xml.endTagNewLine("Script");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
runScript();
|
||||
}
|
||||
|
||||
public void stopme() {
|
||||
if (THREAD!=null) {
|
||||
THREAD.stopme();
|
||||
}
|
||||
}
|
||||
|
||||
public void restartme() {
|
||||
if (THREAD!=null) {
|
||||
THREAD.restartme();
|
||||
}
|
||||
}
|
||||
|
||||
public void killme() {
|
||||
if (THREAD!=null) {
|
||||
THREAD.killme();
|
||||
THREAD=null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
if (THREAD!=null) {
|
||||
return THREAD.isRunning();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isStopped() {
|
||||
if (THREAD!=null) {
|
||||
return THREAD.isStopped();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void runScript() {
|
||||
killme();
|
||||
THREAD=new ScriptThread(this);
|
||||
THREAD.runme();
|
||||
}
|
||||
|
||||
public void runControlScript(JCanvasPanel jp) {
|
||||
if (isRunning()) {
|
||||
return;
|
||||
}
|
||||
for (ConstructionObject obj : mouseDragEventTargets) {
|
||||
if (obj==jp.O) {
|
||||
THREAD=new ScriptThread(this);
|
||||
THREAD.runme();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareDragAction(ConstructionObject o) {
|
||||
if (isRunning()) {
|
||||
return;
|
||||
}
|
||||
for (ConstructionObject obj : mouseDragEventTargets) {
|
||||
if (obj==o) {
|
||||
THREAD=new ScriptThread(this);
|
||||
THREAD.prepareActionScript(o.getName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void runDragAction() {
|
||||
if (THREAD!=null) {
|
||||
THREAD.runActionScript();
|
||||
}
|
||||
}
|
||||
public void runUpAction(ConstructionObject o){
|
||||
for(ConstructionObject obj : mouseUpEventTargets){
|
||||
if(obj==o){
|
||||
runScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopDragAction() {
|
||||
if (THREAD!=null) {
|
||||
THREAD.stopActionScript();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshMouseDragInputField() {
|
||||
if (currentInputField!=null) {
|
||||
currentInputField.setText(getMouseDragTargetNames());
|
||||
otherInputField.setText(getMouseUpTargetNames());
|
||||
}
|
||||
}
|
||||
public void refreshMouseUpInputField() {
|
||||
if (currentInputField!=null) {
|
||||
currentInputField.setText(getMouseUpTargetNames());
|
||||
otherInputField.setText(getMouseDragTargetNames());
|
||||
}
|
||||
}
|
||||
|
||||
public void setMouseDragTool(ZTextFieldAndLabel current, ZTextFieldAndLabel other) {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
currentInputField=current;
|
||||
otherInputField = other;
|
||||
PaletteManager.deselectgeomgroup();
|
||||
zc.setTool(new Scripts_SetMouseDrag(this));
|
||||
setTargetSelected(zc, mouseDragEventTargets, true);
|
||||
}
|
||||
}
|
||||
public void setMouseUpTool(ZTextFieldAndLabel current, ZTextFieldAndLabel other) {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
currentInputField=current;
|
||||
otherInputField = other;
|
||||
PaletteManager.deselectgeomgroup();
|
||||
zc.setTool(new Scripts_SetMouseUp(this));
|
||||
setTargetSelected(zc, mouseUpEventTargets, true);
|
||||
}
|
||||
}
|
||||
|
||||
public String getMouseDragTargetNames() {
|
||||
return getTargetNames(mouseDragEventTargets);
|
||||
}
|
||||
public String getMouseUpTargetNames() {
|
||||
return getTargetNames(mouseUpEventTargets);
|
||||
}
|
||||
|
||||
public void fixmouseDragTargetsNames(){
|
||||
mouseDragTargetsNames=getTargetNames(mouseDragEventTargets);
|
||||
}
|
||||
public void fixmouseUpTargetsNames(){
|
||||
mouseUpTargetsNames=getTargetNames(mouseUpEventTargets);
|
||||
}
|
||||
|
||||
public void reloadMouseDragTargets(){
|
||||
loadTargets(mouseDragEventTargets, mouseDragTargetsNames);
|
||||
}
|
||||
public void reloadMouseUpTargets(){
|
||||
loadTargets(mouseUpEventTargets, mouseUpTargetsNames);
|
||||
}
|
||||
|
||||
public void setMouseDragTargets(String t) {
|
||||
setTargets(mouseDragEventTargets, t);
|
||||
}
|
||||
public void setMouseUpTargets(String t) {
|
||||
setTargets(mouseUpEventTargets, t);
|
||||
}
|
||||
|
||||
public void addMouseDragTarget(ConstructionObject o) {
|
||||
addTarget(mouseDragEventTargets, o);
|
||||
}
|
||||
public void addMouseUpTarget(ConstructionObject o) {
|
||||
addTarget(mouseUpEventTargets, o);
|
||||
}
|
||||
|
||||
public void removeMouseDragTarget(ConstructionObject o) {
|
||||
removeTarget(mouseDragEventTargets, o);
|
||||
}
|
||||
public void removeMouseUpTarget(ConstructionObject o) {
|
||||
removeTarget(mouseUpEventTargets, o);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mouse Over Input Field (not implemented)
|
||||
*/
|
||||
public void refreshMouseOverInputField() {
|
||||
if (currentInputField!=null) {
|
||||
currentInputField.setText(getMouseOverTargetNames());
|
||||
}
|
||||
}
|
||||
|
||||
// public void setMouseOverTool(ZTextFieldAndLabel current) {
|
||||
// ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
// if (zc!=null) {
|
||||
// currentInputField=current;
|
||||
// PaletteManager.deselectgeomgroup();
|
||||
// zc.setTool(new Scripts_SetMouseOver(this));
|
||||
// setTargetSelected(zc, mouseOverEventTargets, true);
|
||||
// }
|
||||
// }
|
||||
|
||||
public String getMouseOverTargetNames() {
|
||||
return getTargetNames(mouseOverEventTargets);
|
||||
}
|
||||
|
||||
// public void setMouseOverTargets(String t) {
|
||||
// setTargets(mouseOverEventTargets, t);
|
||||
// }
|
||||
//
|
||||
public void addMouseOverTarget(ConstructionObject o) {
|
||||
addTarget(mouseOverEventTargets, o);
|
||||
}
|
||||
|
||||
public void removeMouseOverTarget(ConstructionObject o) {
|
||||
removeTarget(mouseOverEventTargets, o);
|
||||
}
|
||||
/*
|
||||
* End
|
||||
*/
|
||||
|
||||
private String getTargetNames(ArrayList<ConstructionObject> targets) {
|
||||
String names="";
|
||||
for (int i=0; i<targets.size(); i++) {
|
||||
names+=";"+targets.get(i).getName();
|
||||
}
|
||||
return names.replaceFirst(";", "");
|
||||
}
|
||||
|
||||
private void loadTargets(ArrayList<ConstructionObject> targets, String t) {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
targets.clear();
|
||||
String[] names=t.split(";");
|
||||
for (int i=0; i<names.length; i++) {
|
||||
ConstructionObject o=zc.getConstruction().find(names[i]);
|
||||
if (o!=null) {
|
||||
targets.add(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTargets(ArrayList<ConstructionObject> targets, String t) {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
setTargetSelected(zc, targets, false);
|
||||
loadTargets(targets,t);
|
||||
setTargetSelected(zc, targets, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void addTarget(ArrayList<ConstructionObject> targets, ConstructionObject o) {
|
||||
targets.add(o);
|
||||
}
|
||||
|
||||
private void removeTarget(ArrayList<ConstructionObject> targets, ConstructionObject o) {
|
||||
targets.remove(o);
|
||||
}
|
||||
|
||||
private void setTargetSelected(ZirkelCanvas zc, ArrayList<ConstructionObject> targets, boolean sel) {
|
||||
zc.clearSelected();
|
||||
for (int i=0; i<targets.size(); i++) {
|
||||
targets.get(i).setSelected(sel);
|
||||
}
|
||||
zc.repaint();
|
||||
}
|
||||
}
|
20
eric/JSprogram/ScriptItemsArray.java
Normal file
20
eric/JSprogram/ScriptItemsArray.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.JSprogram;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ScriptItemsArray extends ArrayList<ScriptItem>{
|
||||
|
||||
public ScriptItemsArray(){
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
432
eric/JSprogram/ScriptPanel.java
Normal file
432
eric/JSprogram/ScriptPanel.java
Normal file
|
@ -0,0 +1,432 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.FileTools;
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.window.myJMenuItem;
|
||||
import eric.controls.JCanvasPanel;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JMenu;
|
||||
import eric.JEricPanel;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
import rene.gui.Global;
|
||||
import rene.util.xml.XmlTree;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
import rene.zirkel.objects.ConstructionObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake, modified by PM Mazat
|
||||
*/
|
||||
public class ScriptPanel extends JEricPanel {
|
||||
|
||||
private ArrayList<String> BACKUPS=new ArrayList<String>();
|
||||
private ZirkelCanvas ZC;
|
||||
private ScriptItemsArray items=new ScriptItemsArray();
|
||||
private ArrayList<ScriptItem> itemsbackup;
|
||||
private static Image icon=themes.getImage("scripts.png");
|
||||
private int W=32, H=32, X=10, Y=10;
|
||||
private ScriptsManager ScriptsManagerPanel=null;
|
||||
private static int ScriptsManagerPanel_X=3, ScriptsManagerPanel_Y=45, ScriptsManagerPanel_WIDTH=3*12+180+90;
|
||||
|
||||
public ScriptPanel(ZirkelCanvas zc) {
|
||||
ZC=zc;
|
||||
setBounds(X, Y, W, H);
|
||||
|
||||
MouseListener ml = new MouseAdapter(){
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e){
|
||||
showPopup();
|
||||
}
|
||||
};
|
||||
|
||||
this.addMouseListener(ml);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
g.drawImage(icon, 0, 0, W, H, this);
|
||||
}
|
||||
|
||||
public void Backup() {
|
||||
try {
|
||||
BACKUPS.add(FileTools.getCurrentFileSource());
|
||||
fixConsoleBackBtn();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBackup() {
|
||||
return (BACKUPS.size()>0);
|
||||
}
|
||||
|
||||
public void Restore() {
|
||||
ZC.killAllScripts();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
backupScriptItems();
|
||||
if (BACKUPS.size()>0) {
|
||||
ZC.getConstruction().clear();
|
||||
try {
|
||||
FileTools.setCurrentFileSource(BACKUPS.get(BACKUPS.size()-1));
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
BACKUPS.remove(BACKUPS.size()-1);
|
||||
|
||||
}
|
||||
restoreScriptItems();
|
||||
fixConsoleBackBtn();
|
||||
/*
|
||||
* Si on a ajouté un script après avoir lancé d'un script de bibliothèque
|
||||
* le panneau n'est pas affiché après l'annulation
|
||||
*/
|
||||
if(items.size()!=0)
|
||||
ZC.add(this);
|
||||
}
|
||||
|
||||
public void backupScriptItems() {
|
||||
itemsbackup=new ArrayList<ScriptItem>();
|
||||
for (ScriptItem item : items) {
|
||||
item.fixmouseDragTargetsNames();
|
||||
item.fixmouseUpTargetsNames();
|
||||
itemsbackup.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void restoreScriptItems() {
|
||||
items.clear();
|
||||
for (ScriptItem item : itemsbackup) {
|
||||
item.reloadMouseDragTargets();
|
||||
item.reloadMouseUpTargets();
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void fixConsoleBackBtn() {
|
||||
for (ScriptItem item : items) {
|
||||
JSEditor jsc=item.getEditor();
|
||||
if (jsc!=null) {
|
||||
jsc.setBackBtnEnabled(BACKUPS.size()>0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showPopup() {
|
||||
JPopupMenu popup = new JPopupMenu();
|
||||
|
||||
// add Cancel Item :
|
||||
myJMenuItem item=new myJMenuItem(Global.Loc("JSmenu.cancel"), themes.resizeExistingIcon("/eric/GUI/icons/jswindow/restore.png", 16, 16)) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
onlyRemoveScriptsManagerPanel();
|
||||
Restore();
|
||||
}
|
||||
};
|
||||
item.setEnabled(isBackup());
|
||||
popup.add(item);
|
||||
popup.add(new JSeparator());
|
||||
|
||||
// add New Script Item :
|
||||
item=new myJMenuItem(Global.Loc("JSmenu.add")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
newScript();
|
||||
}
|
||||
};
|
||||
popup.add(item);
|
||||
popup.add(new JSeparator());
|
||||
|
||||
// add Run script Items :
|
||||
for (int i=0; i<items.size(); i++) {
|
||||
final int I=i;
|
||||
item=new myJMenuItem(items.get(i), themes.resizeExistingIcon("/eric/GUI/icons/jswindow/run.png", 12, 16)) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
onlyRemoveScriptsManagerPanel();
|
||||
items.get(I).runScript();
|
||||
}
|
||||
};
|
||||
item.setEnabled(!items.get(i).isRunning());
|
||||
popup.add(item);
|
||||
}
|
||||
popup.add(new JSeparator());
|
||||
|
||||
// add Kill Item :
|
||||
item=new myJMenuItem(Global.Loc("JSmenu.killall")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
ZC.killAllScripts();
|
||||
}
|
||||
};
|
||||
item.setEnabled(ZC.isThereAnyScriptRunning());
|
||||
popup.add(item);
|
||||
|
||||
// add Stop Item :
|
||||
item=new myJMenuItem(Global.Loc("JSmenu.stopall")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
ZC.stopAllScripts();
|
||||
}
|
||||
};
|
||||
item.setEnabled(ZC.isThereAnyScriptRunning()&&!ZC.isThereAnyStoppedScripts());
|
||||
popup.add(item);
|
||||
|
||||
// add Restart Item :
|
||||
item=new myJMenuItem(Global.Loc("JSmenu.restartall")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
ZC.restartAllScripts();
|
||||
}
|
||||
};
|
||||
item.setEnabled(ZC.isThereAnyStoppedScripts());
|
||||
popup.add(item);
|
||||
popup.add(new JSeparator());
|
||||
|
||||
// add Modify Menu :
|
||||
JMenu modifypopup=new JMenu(Global.Loc("JSmenu.modify"));
|
||||
for (int i=0; i<items.size(); i++) {
|
||||
final int itemnum=i;
|
||||
item=new myJMenuItem(items.get(i).getScriptName()) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
items.get(itemnum).openEmbeddedScript();
|
||||
}
|
||||
};
|
||||
modifypopup.add(item);
|
||||
modifypopup.setFont(themes.TabMenusFont);
|
||||
}
|
||||
popup.add(modifypopup);
|
||||
|
||||
// add Delete Menu :
|
||||
JMenu deletepopup=new JMenu(Global.Loc("JSmenu.delete"));
|
||||
for (int i=0; i<items.size(); i++) {
|
||||
final int itemnum=i;
|
||||
item=new myJMenuItem(items.get(i).getScriptName()) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
removeScript(items.get(itemnum));
|
||||
}
|
||||
};
|
||||
deletepopup.add(item);
|
||||
deletepopup.setFont(themes.TabMenusFont);
|
||||
}
|
||||
popup.add(deletepopup);
|
||||
|
||||
// add Scripts Manager Item
|
||||
item=new myJMenuItem(Global.Loc("JSmenu.ScriptsManager")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
addScriptsManagerPanel();
|
||||
}
|
||||
};
|
||||
popup.add(item);
|
||||
|
||||
popup.show(this, W-10, H);
|
||||
}
|
||||
|
||||
public void onlyRemoveScriptsManagerPanel() {
|
||||
if (ScriptsManagerPanel!=null) {
|
||||
ZC.remove(ScriptsManagerPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScriptsManagerPanel() {
|
||||
if (ScriptsManagerPanel!=null) {
|
||||
ScriptsManagerPanel_X=ScriptsManagerPanel.getLocation().x;
|
||||
ScriptsManagerPanel_Y=ScriptsManagerPanel.getLocation().y;
|
||||
ZC.remove(ScriptsManagerPanel);
|
||||
//ZC.repaint();
|
||||
ScriptsManagerPanel=null;
|
||||
PaletteManager.ClicOn("move");
|
||||
}
|
||||
}
|
||||
|
||||
public void addScriptsManagerPanel() {
|
||||
final int h;
|
||||
removeScriptsManagerPanel();
|
||||
h=((items.size()==1?0:items.size())+(items.size()==2?1:0))*18+168; //147
|
||||
ScriptsManagerPanel=new ScriptsManager(ZC, this, items, ScriptsManagerPanel_X, ScriptsManagerPanel_Y, ScriptsManagerPanel_WIDTH, h);
|
||||
ZC.add(ScriptsManagerPanel);
|
||||
ZC.repaint();
|
||||
ScriptsManagerPanel.init();
|
||||
PaletteManager.deselectgeomgroup();
|
||||
ZC.showStatus("");
|
||||
ZC.showStatus(Global.Loc("JSmenu.ScriptsManager"));
|
||||
}
|
||||
|
||||
public ScriptItemsArray getScripts() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public boolean isThereAnyOnLoadScript() {
|
||||
for (ScriptItem item : items) {
|
||||
if (item.getExecuteOnLoad()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void runOnLoadScripts() {
|
||||
if (isThereAnyOnLoadScript()) {
|
||||
try {
|
||||
String myfile=FileTools.getCurrentFileSource();
|
||||
for (ScriptItem item : items) {
|
||||
if (item.getExecuteOnLoad()) {
|
||||
item.runScript();
|
||||
}
|
||||
}
|
||||
BACKUPS.clear();
|
||||
BACKUPS.add(myfile);
|
||||
fixConsoleBackBtn();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllScripts() {
|
||||
while (items.size()>0) {
|
||||
removeScript(items.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScript(ScriptItem si) {
|
||||
ZC.getConstruction().haveChanged();
|
||||
items.remove(si);
|
||||
if (items.isEmpty()) {
|
||||
ZC.remove(this);
|
||||
removeScriptsManagerPanel();
|
||||
ZC.repaint();
|
||||
}
|
||||
if (ScriptsManagerPanel!=null) {
|
||||
addScriptsManagerPanel();
|
||||
}
|
||||
}
|
||||
|
||||
public void addScript(XmlTree tree) {
|
||||
items.add(new ScriptItem(this, tree));
|
||||
|
||||
// at first added script, button must be drawn in the canvas :
|
||||
if (items.size()==1) {
|
||||
ZC.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
private ScriptItem findScript(String nme) {
|
||||
for (int i=0; i<items.size(); i++) {
|
||||
if (nme.equals(items.get(i).getScriptName())) {
|
||||
return items.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeScript(String nme) {
|
||||
ScriptItem si=findScript(nme);
|
||||
if (si!=null) {
|
||||
removeScript(si);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveScript(String nme, String source) {
|
||||
ScriptItem si=findScript(nme);
|
||||
if (si!=null) {
|
||||
si.setScriptSource(source);
|
||||
} else {
|
||||
items.add(new ScriptItem(this, nme, source));
|
||||
}
|
||||
if (ScriptsManagerPanel!=null) {
|
||||
addScriptsManagerPanel();
|
||||
}
|
||||
|
||||
// at first added script, button must be drawn in the canvas :
|
||||
if (items.size()==1) {
|
||||
ZC.add(this);
|
||||
ZC.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void openScriptFile(String filename, boolean open) {
|
||||
ScriptItem item=new ScriptItem(this, "", "");
|
||||
items.add(item);
|
||||
// at first added script, button must be drawn in the canvas :
|
||||
if (items.size()==1) {
|
||||
ZC.add(this);
|
||||
ZC.repaint();
|
||||
}
|
||||
item.openScriptFile(filename, open);
|
||||
}
|
||||
|
||||
public void newScript() {
|
||||
ScriptItem item=new ScriptItem(this, "", "");
|
||||
items.add(item);
|
||||
// at first added script, button must be drawn in the canvas :
|
||||
if (items.size()==1) {
|
||||
ZC.add(this);
|
||||
ZC.repaint();
|
||||
}
|
||||
item.newScriptInConstruction();
|
||||
// if Scripts Manager is visible, it must be updated
|
||||
if (ScriptsManagerPanel!=null) {
|
||||
addScriptsManagerPanel();
|
||||
}
|
||||
}
|
||||
|
||||
public void runControlScripts(JCanvasPanel jp) {
|
||||
for (ScriptItem item : items) {
|
||||
item.runControlScript(jp);
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareDragActionScript(ConstructionObject o) {
|
||||
for (ScriptItem item : items) {
|
||||
item.prepareDragAction(o);
|
||||
}
|
||||
}
|
||||
|
||||
public void runDragAction() {
|
||||
for (ScriptItem item : items) {
|
||||
item.runDragAction();
|
||||
}
|
||||
}
|
||||
public void runUpAction(ConstructionObject o) {
|
||||
for(ScriptItem item : items){
|
||||
item.runUpAction(o);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopDragAction() {
|
||||
for (ScriptItem item : items) {
|
||||
item.stopDragAction();
|
||||
}
|
||||
}
|
||||
|
||||
public void fixMouseTargets() {
|
||||
for (ScriptItem item : items) {
|
||||
item.fixMouseTargets();
|
||||
}
|
||||
}
|
||||
}
|
1650
eric/JSprogram/ScriptThread.java
Normal file
1650
eric/JSprogram/ScriptThread.java
Normal file
File diff suppressed because it is too large
Load diff
300
eric/JSprogram/ScriptsManager.java
Normal file
300
eric/JSprogram/ScriptsManager.java
Normal file
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.ZDialog.ZButton;
|
||||
import eric.GUI.ZDialog.ZCheckBox;
|
||||
import eric.GUI.ZDialog.ZDialog;
|
||||
import eric.GUI.ZDialog.ZLabel;
|
||||
import eric.GUI.ZDialog.ZSep;
|
||||
import eric.GUI.ZDialog.ZTextFieldAndLabel;
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.OS;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import rene.gui.Global;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author PM Mazat
|
||||
*/
|
||||
public class ScriptsManager extends ZDialog implements ListSelectionListener, FocusListener {
|
||||
|
||||
private ZirkelCanvas ZC;
|
||||
private int SCRIPTS_WIDTH=180, SCRIPTS_HEIGHT, ACTION_WIDTH=110,RENAME_WIDTH=70, BTN_Y;
|
||||
private ZButton upBTN, downBTN;
|
||||
private ZTextFieldAndLabel renameFIELD, mousedragFIELD, mouseupFIELD;
|
||||
private ZCheckBox onstartCKBOX;
|
||||
private ZSep behaveSEP, renameSEP;
|
||||
private ZLabel behaveLBL;
|
||||
private DefaultListModel listModel;
|
||||
private ScriptItemsArray items=new ScriptItemsArray();
|
||||
private JList list;
|
||||
private ScriptPanel JP;
|
||||
|
||||
public ScriptsManager(ZirkelCanvas zc, ScriptPanel jp, ScriptItemsArray items, int x, int y, int w, int h) {
|
||||
super(Global.Loc("JSmenu.ScriptsManager"), x, y, w, h, true, true);
|
||||
ZC=zc;
|
||||
JP=jp;
|
||||
this.items=items;
|
||||
SCRIPTS_HEIGHT=items.size()==1?0:items.size()*18;
|
||||
BTN_Y=THEIGHT+(SCRIPTS_HEIGHT+(items.size()==2?1:0)*18)/2;
|
||||
addContent();
|
||||
}
|
||||
|
||||
private void addContent() {
|
||||
upBTN=new ZButton(Global.Loc("JSmenu.up")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
if (list.getSelectedIndex()!=0) {
|
||||
refreshList(list.getSelectedIndex(), -1);
|
||||
}
|
||||
}
|
||||
};
|
||||
upBTN.addFocusListener(this);
|
||||
|
||||
downBTN=new ZButton(Global.Loc("JSmenu.down")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
if (list.getSelectedIndex()!=items.size()-1) {
|
||||
refreshList(list.getSelectedIndex(), 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
downBTN.addFocusListener(this);
|
||||
if (OS.isUnix()) {
|
||||
downBTN.setFont(downBTN.getFont().deriveFont(10f));
|
||||
}
|
||||
|
||||
behaveSEP=new ZSep(75);
|
||||
renameSEP=new ZSep(75);
|
||||
// behaveLBL=new ZLabel("Script behavior :");
|
||||
|
||||
renameFIELD=new ZTextFieldAndLabel(Global.Loc("JSmenu.rename"), items.get(0).getScriptName(), RENAME_WIDTH, CHEIGHT) {
|
||||
|
||||
@Override
|
||||
public void actionKey(KeyEvent k){
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setScriptName(renameFIELD.getText());
|
||||
listModel.setElementAt(renameFIELD.getText(), i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionMouse() {
|
||||
closeScriptTools();
|
||||
}
|
||||
};
|
||||
renameFIELD.addFocusListener(this);
|
||||
|
||||
|
||||
onstartCKBOX=new ZCheckBox(Global.Loc("JSmenu.executeonstart"), false) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
// MAN.setHidefinals(hideFinalBox.isSelected());
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setExecuteOnLoad(onstartCKBOX.isSelected());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mousedragFIELD=new ZTextFieldAndLabel(Global.Loc("JSmenu.dragaction"), "", ACTION_WIDTH, CHEIGHT) {
|
||||
|
||||
@Override
|
||||
public void actionMouse() {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setMouseDragTool(mousedragFIELD, mouseupFIELD);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionKey(KeyEvent k) {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setMouseDragTargets(getText());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mouseupFIELD=new ZTextFieldAndLabel("On mouse up :", "", ACTION_WIDTH, CHEIGHT) {
|
||||
|
||||
@Override
|
||||
public void actionMouse() {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setMouseUpTool(mouseupFIELD, mousedragFIELD);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionKey(KeyEvent k) {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
items.get(i).setMouseUpTargets(getText());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// mouseoverFIELD=new ZTextFieldAndLabel("Over :", "", RENAME_WIDTH, CHEIGHT) {
|
||||
//
|
||||
// @Override
|
||||
// public void actionMouse() {
|
||||
// int i=list.getSelectedIndex();
|
||||
// if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
// items.get(i).setMouseOverTool(mouseoverFIELD);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void actionKey() {
|
||||
// int i=list.getSelectedIndex();
|
||||
// if (i!=-1&&!renameFIELD.getText().isEmpty()) {
|
||||
// items.get(i).setMouseOverTargets(getText());
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
|
||||
listModel=new DefaultListModel();
|
||||
for (int i=0; i<items.size(); i++) {
|
||||
listModel.add(i, items.get(i).getScriptName());
|
||||
}
|
||||
list=new JList(listModel);
|
||||
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
list.setBackground(new Color(216, 216, 216));
|
||||
list.setSelectedIndex(0);
|
||||
list.addListSelectionListener(this);
|
||||
list.addFocusListener(this);
|
||||
upBTN.setEnabled(false); //because the default SelectedIndex of "list" is 0 and it can't be shifted up
|
||||
|
||||
if (items.size()!=1) {
|
||||
this.add(upBTN);
|
||||
this.add(downBTN);
|
||||
this.add(list);
|
||||
}
|
||||
this.add(renameFIELD);
|
||||
this.add(behaveSEP);
|
||||
this.add(onstartCKBOX);
|
||||
this.add(mousedragFIELD);
|
||||
this.add(mouseupFIELD);
|
||||
// this.add(mouseoverFIELD);
|
||||
this.add(renameSEP);
|
||||
this.fixComponents();
|
||||
refreshFields();
|
||||
}
|
||||
|
||||
private void refreshFields() {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i!=-1) {
|
||||
renameFIELD.setText(items.get(i).getScriptName());
|
||||
mousedragFIELD.setText(items.get(i).getMouseDragTargetNames());
|
||||
mouseupFIELD.setText(items.get(i).getMouseUpTargetNames());
|
||||
onstartCKBOX.setSelected(items.get(i).getExecuteOnLoad());
|
||||
// mouseoverFIELD.setText(items.get(i).getMouseOverTargetNames());
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshList(int i, int e) {
|
||||
ScriptItem si=items.get(i+e);
|
||||
Object o=listModel.elementAt(i+e);
|
||||
|
||||
items.set(i+e, items.get(i));
|
||||
listModel.setElementAt(listModel.elementAt(i), i+e);
|
||||
items.set(i, si);
|
||||
listModel.setElementAt(o, i);
|
||||
list.setSelectedIndex(i+e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixComponents() {
|
||||
upBTN.setBounds(D_WIDTH-MARGINW-BWIDTH, BTN_Y-MARGINW/4-CHEIGHT, BWIDTH, CHEIGHT);
|
||||
downBTN.setBounds(D_WIDTH-MARGINW-BWIDTH, BTN_Y+MARGINW/4, BWIDTH, CHEIGHT);
|
||||
list.setBounds(MARGINW, THEIGHT+2, SCRIPTS_WIDTH, SCRIPTS_HEIGHT);
|
||||
int top1=D_HEIGHT-141;//120
|
||||
|
||||
behaveSEP.setBounds(0, top1+5, D_WIDTH, 1);
|
||||
top1+=16;
|
||||
mousedragFIELD.setBounds(MARGINW, top1, D_WIDTH-2*MARGINW, CHEIGHT);
|
||||
mouseupFIELD.setBounds(MARGINW, top1+CHEIGHT+3, D_WIDTH-2*MARGINW, CHEIGHT);
|
||||
// mouseoverFIELD.setBounds(MARGINW, top1+CHEIGHT+3, PANEL_WIDTH-2*MARGINW, CHEIGHT);
|
||||
onstartCKBOX.setBounds(MARGINW, top1+2*CHEIGHT+9, D_WIDTH-2*MARGINW, CHEIGHT);
|
||||
|
||||
renameSEP.setBounds(0, top1+3*CHEIGHT+20, D_WIDTH, 1);
|
||||
renameFIELD.setBounds(MARGINW, top1+4*CHEIGHT+20, D_WIDTH-2*MARGINW, CHEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doClose() {
|
||||
JP.removeScriptsManagerPanel();
|
||||
}
|
||||
|
||||
public void closeScriptTools() {
|
||||
ZC.clearSelected();
|
||||
PaletteManager.setSelected_with_clic("point", true);
|
||||
}
|
||||
|
||||
//required by ListSelectionListener
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
int i=list.getSelectedIndex();
|
||||
if (i==-1) {
|
||||
//No selection, disable buttons
|
||||
upBTN.setEnabled(false);
|
||||
downBTN.setEnabled(false);
|
||||
renameFIELD.setText("");
|
||||
mousedragFIELD.setText("");
|
||||
mouseupFIELD.setText("");
|
||||
onstartCKBOX.setSelected(false);
|
||||
// mouseoverFIELD.setText("");
|
||||
} else {
|
||||
if (i==0) {
|
||||
upBTN.setEnabled(false);
|
||||
downBTN.setEnabled(true);
|
||||
} else {
|
||||
if (i==items.size()-1) {
|
||||
upBTN.setEnabled(true);
|
||||
downBTN.setEnabled(false);
|
||||
} else {
|
||||
upBTN.setEnabled(true);
|
||||
downBTN.setEnabled(true);
|
||||
}
|
||||
}
|
||||
renameFIELD.setText(items.get(i).getScriptName());
|
||||
mousedragFIELD.setText(items.get(i).getMouseDragTargetNames());
|
||||
mouseupFIELD.setText(items.get(i).getMouseUpTargetNames());
|
||||
onstartCKBOX.setSelected(items.get(i).getExecuteOnLoad());
|
||||
// mouseoverFIELD.setText(items.get(i).getMouseOverTargetNames());
|
||||
}
|
||||
closeScriptTools();
|
||||
}
|
||||
|
||||
//required by FocusListener
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
PaletteManager.deselectgeomgroup();
|
||||
//ZC.showStatus("");
|
||||
ZC.showStatus(Global.Loc("JSmenu.ScriptsManager"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
ZC.showStatus();
|
||||
}
|
||||
}
|
138
eric/JSprogram/myJTitleBar.java
Normal file
138
eric/JSprogram/myJTitleBar.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.OS;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.net.URL;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import eric.JEricPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class myJTitleBar extends JEricPanel {
|
||||
|
||||
private ImageIcon myimage1, myimage2;
|
||||
private JEricPanel titlespacer;
|
||||
private JEricPanel macosspacer;
|
||||
private JEricPanel buttons;
|
||||
private JLabel windowtitle;
|
||||
private JButton closebtn;
|
||||
private ImageIcon myclosebtn;
|
||||
private ImageIcon myclosebtnover;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
final java.awt.Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
final int dh=h/2+1;
|
||||
|
||||
final Graphics2D g2=(Graphics2D) g;
|
||||
super.paintComponent(g);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
// RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
// RenderingHints.VALUE_RENDER_QUALITY);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
// RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
// RenderingHints.VALUE_STROKE_PURE);
|
||||
|
||||
|
||||
g2.drawImage(myimage1.getImage(), 0, 0, w, dh, this);
|
||||
g2.drawImage(myimage2.getImage(), 0, dh, w, h-dh, this);
|
||||
|
||||
}
|
||||
|
||||
public myJTitleBar() {
|
||||
super();
|
||||
myimage1=themes.getIcon("titlebar.gif");
|
||||
myimage2=themes.getIcon("menubar.gif");
|
||||
myclosebtn=themes.getIcon("zclosebutton.png");
|
||||
myclosebtnover=themes.getIcon("zclosebuttonover.png");
|
||||
|
||||
this.setLayout(new javax.swing.BoxLayout(this,
|
||||
javax.swing.BoxLayout.X_AXIS));
|
||||
// init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
this.removeAll();
|
||||
titlespacer=new JEricPanel();
|
||||
titlespacer.setOpaque(false);
|
||||
|
||||
macosspacer=new JEricPanel();
|
||||
macosspacer.setOpaque(false);
|
||||
|
||||
buttons=new JEricPanel();
|
||||
buttons.setLayout(new javax.swing.BoxLayout(buttons,
|
||||
javax.swing.BoxLayout.X_AXIS));
|
||||
buttons.setOpaque(false);
|
||||
|
||||
windowtitle=new JLabel("");
|
||||
windowtitle.setFont(new Font(Global.GlobalFont, 0, 12));
|
||||
windowtitle.setForeground(new Color(80, 80, 80));
|
||||
windowtitle.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
|
||||
|
||||
|
||||
closebtn=new JButton();
|
||||
closebtn.setBorder(BorderFactory.createEmptyBorder());
|
||||
closebtn.setOpaque(false);
|
||||
closebtn.setContentAreaFilled(false);
|
||||
closebtn.setFocusable(false);
|
||||
closebtn.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
// JMacrosTools.activate(MW);
|
||||
// JMacrosTools.disposeCurrentJZF();
|
||||
}
|
||||
});
|
||||
|
||||
closebtn.setIcon(myclosebtn);
|
||||
closebtn.setRolloverIcon(myclosebtnover);
|
||||
|
||||
if ((OS.isMac())) {
|
||||
this.add(macosspacer);
|
||||
buttons.add(closebtn);
|
||||
this.add(buttons);
|
||||
this.add(titlespacer);
|
||||
this.add(windowtitle);
|
||||
} else {
|
||||
this.add(titlespacer);
|
||||
this.add(windowtitle);
|
||||
buttons.add(closebtn);
|
||||
this.add(buttons);
|
||||
|
||||
}
|
||||
|
||||
titlespacer.setAlignmentY(0.0f);
|
||||
macosspacer.setAlignmentY(0.0f);
|
||||
windowtitle.setAlignmentY(0.0f);
|
||||
buttons.setAlignmentY(0.0f);
|
||||
|
||||
closebtn.setAlignmentY(0.5F);
|
||||
|
||||
this.revalidate();
|
||||
}
|
||||
}
|
50
eric/JSprogram/myJVerticalSeparatorPanel.java
Normal file
50
eric/JSprogram/myJVerticalSeparatorPanel.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.net.URL;
|
||||
import javax.swing.ImageIcon;
|
||||
import eric.JEricPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class myJVerticalSeparatorPanel extends JEricPanel {
|
||||
|
||||
private ImageIcon myimage;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
final java.awt.Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=(Graphics2D) g;
|
||||
|
||||
// g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
// RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
// RenderingHints.VALUE_RENDER_QUALITY);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
// RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
// RenderingHints.VALUE_STROKE_PURE);
|
||||
|
||||
|
||||
g2.drawImage(myimage.getImage(), 0, 0, w, h, this);
|
||||
}
|
||||
|
||||
public myJVerticalSeparatorPanel() {
|
||||
super();
|
||||
myimage=themes.getIcon("verticalseparator.png");
|
||||
}
|
||||
}
|
50
eric/JSprogram/myStatusBarPanel.java
Normal file
50
eric/JSprogram/myStatusBarPanel.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.JSprogram;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.net.URL;
|
||||
import javax.swing.ImageIcon;
|
||||
import eric.JEricPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class myStatusBarPanel extends JEricPanel {
|
||||
|
||||
private ImageIcon myimage;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
final java.awt.Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=(Graphics2D) g;
|
||||
|
||||
// g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
// RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
// RenderingHints.VALUE_RENDER_QUALITY);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
// RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
// g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
// RenderingHints.VALUE_STROKE_PURE);
|
||||
|
||||
|
||||
g2.drawImage(myimage.getImage(), 0, 0, w, h, this);
|
||||
}
|
||||
|
||||
public myStatusBarPanel() {
|
||||
super();
|
||||
myimage=themes.getIcon("statusbar.gif");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue