Make first real commit: copy of CaRMetal 4.2.8
BIN
eric/.DS_Store
vendored
Normal file
1194
eric/FileTools.java
Normal file
BIN
eric/GUI/.DS_Store
vendored
Normal file
55
eric/GUI/ZDialog/ZButton.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JButton;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZButton extends JButton {
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
public ZButton(String lbl) {
|
||||
super(lbl);
|
||||
setOpaque(false);
|
||||
setFont(new Font(Global.GlobalFont, 0, 11));
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
action();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void action() {
|
||||
}
|
||||
|
||||
public void pressed(final ZButton button) {
|
||||
class pressed implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
button.setEnabled(false);
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ex) {}
|
||||
button.setEnabled(true);
|
||||
}
|
||||
}
|
||||
new Thread(new pressed()).start();
|
||||
}
|
||||
}
|
70
eric/GUI/ZDialog/ZCheckBox.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZCheckBox extends JLabel {
|
||||
|
||||
private boolean selected;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
|
||||
super.paintComponent(g);
|
||||
if (selected) {
|
||||
g.drawImage(themes.getImage("chkboxON.gif"), 0, 2, this);
|
||||
} else {
|
||||
g.drawImage(themes.getImage("chkboxOFF.gif"), 0, 2, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ZCheckBox(String lbl, boolean value) {
|
||||
super(lbl);
|
||||
selected=value;
|
||||
setFont(ZTools.ZCheckBoxFont);
|
||||
setFocusable(false);
|
||||
setIcon(themes.getIcon("pixel"));
|
||||
setIconTextGap(20);
|
||||
setVerticalTextPosition(SwingConstants.CENTER);
|
||||
setVerticalAlignment(SwingConstants.CENTER);
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
setSelected(!selected);
|
||||
action();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean b) {
|
||||
selected=b;
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
zc.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void action() {
|
||||
}
|
||||
}
|
263
eric/GUI/ZDialog/ZDialog.java
Normal file
|
@ -0,0 +1,263 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.JEricPanel;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake, lightly modified by PM Mazat
|
||||
*/
|
||||
public class ZDialog extends JEricPanel {
|
||||
|
||||
private ZDialog me;
|
||||
//private RoundRectangle2D roundRect;
|
||||
protected RoundRectangle2D roundRect;
|
||||
//private int cx=0, cy=0, cw=0;
|
||||
protected int cx=0, cy=0, cw=0;
|
||||
private Point origin, winloc;
|
||||
public int D_X, D_Y, D_WIDTH, D_HEIGHT; // Dialog width and height
|
||||
private boolean withTitle=false;
|
||||
private ZDialogTitle title;
|
||||
private boolean withCloseBox=false;
|
||||
private ZDialogCloseBox closebox;
|
||||
//private boolean boxEnter=false;
|
||||
protected boolean boxEnter=false;
|
||||
protected int THEIGHT=22;
|
||||
protected int MARGINTOP1=THEIGHT+8; // Margin top for first component line
|
||||
protected int MARGINTOP2=MARGINTOP1+26; // Margin top for second component line
|
||||
protected int MARGINTOP3=MARGINTOP2+26; // Margin top for third component line
|
||||
protected int MARGINTOP4=MARGINTOP3+26; // Margin top for forth component line
|
||||
protected int MARGINTOP5=MARGINTOP4+26; // Margin top for forth component line
|
||||
protected int ARCCORNER=20; // Round corner size
|
||||
protected int LWIDTH=150; // Label width (for textfields)
|
||||
protected int BWIDTH=90; // Button width
|
||||
protected int CWIDTH=350; // Component width
|
||||
protected int CHEIGHT=19; // Component height
|
||||
protected int MARGINW=12; // Margin left and right
|
||||
protected int NOT_EXIT = 28; //at least NOT_EXIT pixels will be visible
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
if (JZirkelCanvas.isPaintCalled()) {
|
||||
|
||||
Graphics2D g2d=windowComponent.getGraphics2D(g);
|
||||
|
||||
if (isTitleVisible()) {
|
||||
// draw the title background :
|
||||
g2d.setColor(ZTools.backTitleColor);
|
||||
g2d.setClip(0, 0, D_WIDTH, THEIGHT);
|
||||
g2d.fill(roundRect);
|
||||
}
|
||||
|
||||
if (isCloseBoxVisible()) {
|
||||
// draw the close box :
|
||||
g2d.setColor(ZTools.TitleTextColor);
|
||||
if (boxEnter) {
|
||||
g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
||||
} else {
|
||||
g2d.setStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
||||
}
|
||||
g2d.drawOval(cx, cy, cw, cw);
|
||||
int dx=(int) (cw*(1-Math.cos(Math.PI/4)));
|
||||
g2d.drawLine(cx+dx, cy+dx, cx+cw-dx, cy+cw-dx);
|
||||
g2d.drawLine(cx+dx, cy+cw-dx, cx+cw-dx, cy+dx);
|
||||
}
|
||||
|
||||
// draw the content background :
|
||||
g2d.setColor(ZTools.backMainColor);
|
||||
g2d.setClip(0, THEIGHT, D_WIDTH, D_HEIGHT);
|
||||
g2d.fill(roundRect);
|
||||
|
||||
g2d.setClip(0, 0, D_WIDTH, D_HEIGHT);
|
||||
|
||||
g2d.setColor(Color.black);
|
||||
g2d.setStroke(new BasicStroke(0.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
|
||||
g2d.draw(roundRect);
|
||||
g2d.setStroke(new BasicStroke(1f));
|
||||
|
||||
paintChildren(g);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCloseBoxVisible() {
|
||||
return withCloseBox;
|
||||
}
|
||||
|
||||
public void setCloseBoxVisible(boolean b) {
|
||||
withCloseBox=b;
|
||||
}
|
||||
|
||||
public boolean isTitleVisible() {
|
||||
return withTitle;
|
||||
}
|
||||
|
||||
public void setTitleVisible(boolean b) {
|
||||
withTitle=b;
|
||||
}
|
||||
|
||||
public ZDialog(String ttle, int x, int y, int w, int h, boolean withtitle, boolean withclose) {
|
||||
me=this;
|
||||
add(closebox=new ZDialogCloseBox());
|
||||
add(title=new ZDialogTitle(ttle));
|
||||
withTitle=withtitle;
|
||||
withCloseBox=withclose;
|
||||
if (!withtitle) {
|
||||
MARGINTOP1=MARGINTOP1-THEIGHT;
|
||||
MARGINTOP2=MARGINTOP2-THEIGHT;
|
||||
MARGINTOP3=MARGINTOP3-THEIGHT;
|
||||
MARGINTOP4=MARGINTOP4-THEIGHT;
|
||||
THEIGHT=0;
|
||||
}
|
||||
D_X=x;
|
||||
D_Y=y;
|
||||
D_WIDTH=w;
|
||||
D_HEIGHT=h;
|
||||
roundRect=new RoundRectangle2D.Double(2, 2, D_WIDTH-4, D_HEIGHT-4, ARCCORNER, ARCCORNER);
|
||||
|
||||
setLayout(null);
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(D_X, D_Y, D_WIDTH, D_HEIGHT);
|
||||
title.setBounds(0, 0, D_WIDTH, THEIGHT);
|
||||
cw=THEIGHT-8;
|
||||
cx=D_WIDTH-cw-MARGINW;
|
||||
cy=4;
|
||||
closebox.setBounds(cx, cy, cw, cw);
|
||||
fixComponents();
|
||||
}
|
||||
|
||||
public void fixComponents() {
|
||||
}
|
||||
|
||||
public void doClose() {
|
||||
}
|
||||
|
||||
public class ZDialogCloseBox extends JEricPanel {
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g){
|
||||
// CloseBox is painted in the ZDialog paint method,
|
||||
// because it needs backgound in order to render
|
||||
// the antialisasing of strokes.
|
||||
}
|
||||
|
||||
public ZDialogCloseBox() {
|
||||
setOpaque(false);
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (isCloseBoxVisible()) {
|
||||
doClose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
if (isCloseBoxVisible()) {
|
||||
boxEnter=true;
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
zc.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
if (isCloseBoxVisible()) {
|
||||
boxEnter=false;
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
zc.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ZDialogTitle extends JLabel {
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
if (isTitleVisible()) {
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
|
||||
public ZDialogTitle(String ttle) {
|
||||
super(ttle);
|
||||
setFont(ZTools.ZDialogTitleFont);
|
||||
setForeground(ZTools.TitleTextColor);
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setVerticalAlignment(SwingConstants.CENTER);
|
||||
setOpaque(false);
|
||||
|
||||
addMouseMotionListener(new MouseMotionAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
if (isTitleVisible()) {
|
||||
Point current=MouseInfo.getPointerInfo().getLocation();
|
||||
me.setLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||
/*
|
||||
* the ZDialog window doesn't have to exit the main window
|
||||
*/
|
||||
ZirkelCanvas zc = JZirkelCanvas.getCurrentZC();
|
||||
if(me.getLocation().x+me.getWidth()-NOT_EXIT<=0){
|
||||
me.setLocation(-me.getWidth()+NOT_EXIT, me.getLocation().y);
|
||||
}
|
||||
if(me.getLocation().x+NOT_EXIT>=zc.getWidth()){
|
||||
me.setLocation(zc.getWidth()-NOT_EXIT, me.getLocation().y);
|
||||
}
|
||||
if(me.getLocation().y<=0){
|
||||
me.setLocation(me.getLocation().x, 0);
|
||||
}
|
||||
if(me.getLocation().y+NOT_EXIT>=zc.getHeight()){
|
||||
me.setLocation(me.getLocation().x, zc.getHeight()-NOT_EXIT);
|
||||
}
|
||||
/*
|
||||
* end of code
|
||||
*/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isTitleVisible()) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winloc=me.getLocation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void send(String msg) {
|
||||
}
|
||||
}
|
24
eric/GUI/ZDialog/ZLabel.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZLabel extends JLabel {
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
public ZLabel(String s) {
|
||||
super(s);
|
||||
setFont(ZTools.ZLabelFont);
|
||||
}
|
||||
}
|
30
eric/GUI/ZDialog/ZMessageDialog.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import eric.JZirkelCanvas;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZMessageDialog extends ZDialog {
|
||||
|
||||
public ZMessageDialog() {
|
||||
super("essai", 0, 0, 400, 300, true, false);
|
||||
}
|
||||
|
||||
public static void showMessage() {
|
||||
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||
if (zc!=null) {
|
||||
ZMessageDialog zmd=new ZMessageDialog();
|
||||
zc.add(zmd);
|
||||
zmd.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
45
eric/GUI/ZDialog/ZSep.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import eric.JEricPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZSep extends JEricPanel {
|
||||
|
||||
int percent=100;
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
||||
Dimension d=getSize();
|
||||
int margin=d.width*(100-percent)/200;
|
||||
g.setColor(ZTools.backTitleColor);
|
||||
g.fillRect(margin, 0, d.width-2*margin, d.height);
|
||||
|
||||
// Dimension d=getSize();
|
||||
// g.setColor(ZTools.B_TextField);
|
||||
// g.fillRect(0, 0, d.width, d.height);
|
||||
// paintChildren(g);
|
||||
// g.setColor(ZTools.Bord_TextField);
|
||||
// g.drawRect(0, 0, d.width, d.height);
|
||||
// if (withback) {
|
||||
// Dimension d=getSize();
|
||||
// g.setColor(ZTools.backTitleColor);
|
||||
// g.fillRect(0, 0, d.width, d.height);
|
||||
// paintChildren(g);
|
||||
// }
|
||||
// super.paintComponent(g);
|
||||
}
|
||||
|
||||
public ZSep(int prop) {
|
||||
super();
|
||||
percent=prop;
|
||||
}
|
||||
}
|
127
eric/GUI/ZDialog/ZTextField.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import eric.JEricPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZTextField extends JEricPanel {
|
||||
JTextField field;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.setColor(ZTools.B_TextField);
|
||||
g.fillRect(0, 0, d.width, d.height);
|
||||
paintChildren(g);
|
||||
g.setColor(ZTools.Bord_TextField);
|
||||
g.drawRect(0, 0, d.width, d.height);
|
||||
}
|
||||
|
||||
public ZTextField(String s) {
|
||||
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||
setOpaque(false);
|
||||
field=new JTextField(s){
|
||||
@Override
|
||||
public void paintBorder(Graphics g){
|
||||
|
||||
}
|
||||
};
|
||||
field.setMargin(new Insets(0, 0, 0, 0));
|
||||
field.setOpaque(false);
|
||||
field.setFont(ZTools.ZTextFieldFont);
|
||||
field.setForeground(ZTools.C_TextField);
|
||||
field.setBackground(ZTools.B_TextField);
|
||||
field.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyReleased(final KeyEvent e) {
|
||||
actionKey(e);
|
||||
}
|
||||
});
|
||||
field.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
actionMouse();
|
||||
}
|
||||
});
|
||||
field.addFocusListener(new FocusAdapter() {
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
focusOn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
focusOff();
|
||||
}
|
||||
});
|
||||
JEricPanel panel=new JEricPanel();
|
||||
Dimension d=new Dimension(1, 1);
|
||||
panel.setOpaque(false);
|
||||
panel.setPreferredSize(d);
|
||||
panel.setMinimumSize(d);
|
||||
panel.setMaximumSize(d);
|
||||
panel.setSize(d);
|
||||
add(panel);
|
||||
add(field);
|
||||
}
|
||||
|
||||
public void actionMouse() {
|
||||
}
|
||||
|
||||
public void actionKey(KeyEvent k) {
|
||||
}
|
||||
|
||||
public void focusOn(){
|
||||
}
|
||||
|
||||
public void focusOff(){
|
||||
}
|
||||
|
||||
public void setEditable(boolean b){
|
||||
if (field!=null) {
|
||||
field.setEditable(b);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHorizontalAlignment(int align){
|
||||
field.setHorizontalAlignment(align);
|
||||
}
|
||||
public String getText(){
|
||||
return field.getText();
|
||||
}
|
||||
public void setText(String s){
|
||||
field.setText(s);
|
||||
}
|
||||
public void selectAll(){
|
||||
field.selectAll();
|
||||
}
|
||||
@Override
|
||||
public void setForeground(Color c){
|
||||
if (field!=null) {
|
||||
field.setForeground(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
132
eric/GUI/ZDialog/ZTextFieldAndLabel.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import eric.JEricPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZTextFieldAndLabel extends JEricPanel {
|
||||
|
||||
private ZTextFieldAndLabel me;
|
||||
private myTextField field=null;
|
||||
private ZLabel label=null;
|
||||
private String InitValue="";
|
||||
private int labelWidth=100;
|
||||
private int labelHeight=20;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
paintChildren(g);
|
||||
}
|
||||
|
||||
public ZTextFieldAndLabel(String lbl, String value, int labelwidth,int labelheight) {
|
||||
super();
|
||||
me=this;
|
||||
labelWidth=labelwidth;
|
||||
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||
setOpaque(false);
|
||||
if (labelWidth==0) {
|
||||
InitValue="<"+lbl+">";
|
||||
if ("".equals(value)) {
|
||||
add(field=new myTextField(InitValue));
|
||||
field.setForeground(ZTools.C_TextField_OFF);
|
||||
} else {
|
||||
add(field=new myTextField(value));
|
||||
}
|
||||
field.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
} else {
|
||||
add(label=new ZLabel(lbl));
|
||||
add(field=new myTextField(value));
|
||||
ZTools.fixsize(label, labelWidth, labelheight);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionMouse() {
|
||||
}
|
||||
|
||||
public void actionKey(java.awt.event.KeyEvent k){
|
||||
}
|
||||
|
||||
public void focusLost(){
|
||||
}
|
||||
|
||||
public void focusGained(){
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
if (InitValue.equals(field.getText())) {
|
||||
return "";
|
||||
} else {
|
||||
return field.getText();
|
||||
}
|
||||
}
|
||||
|
||||
public void setText(String txt) {
|
||||
if ("".equals(txt)) {
|
||||
txt=InitValue;
|
||||
field.setForeground(ZTools.C_TextField_OFF);
|
||||
} else {
|
||||
field.setForeground(ZTools.C_TextField);
|
||||
}
|
||||
field.setText(txt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForeground(Color c){
|
||||
if(field!=null){
|
||||
field.setForeground(c);
|
||||
}
|
||||
}
|
||||
|
||||
public void setEditable(boolean b){
|
||||
if (field!=null){
|
||||
field.setEditable(b);
|
||||
}
|
||||
}
|
||||
|
||||
private class myTextField extends ZTextField {
|
||||
|
||||
public myTextField(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionMouse() {
|
||||
me.actionMouse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionKey(java.awt.event.KeyEvent k){
|
||||
me.actionKey(k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusOn() {
|
||||
if ((field.getText().equals(InitValue))) {
|
||||
field.setText("");
|
||||
field.setForeground(ZTools.C_TextField);
|
||||
}
|
||||
field.selectAll();
|
||||
me.focusGained();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusOff() {
|
||||
if ((field.getText().equals(""))) {
|
||||
field.setText(InitValue);
|
||||
field.setForeground(ZTools.C_TextField_OFF);
|
||||
}
|
||||
me.focusLost();
|
||||
}
|
||||
}
|
||||
}
|
39
eric/GUI/ZDialog/ZTools.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.ZDialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JComponent;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ZTools {
|
||||
public static final Color backMainColor=new Color(100, 100, 100, 50);
|
||||
public static final Color backTitleColor=new Color(0, 0, 0, 200);
|
||||
public static final Color TitleTextColor=new Color(255, 255, 255);
|
||||
public static final Color C_TextField=new Color(50, 50, 50); // Text color of ZTextFields
|
||||
public static final Color C_TextField_OFF=new Color(150, 150, 150); // Disable Text color of ZTextFields
|
||||
public static final Color B_TextField=new Color(245, 246, 255); // ZTextFields background color
|
||||
public static final Color Bord_TextField=new Color(50, 50, 50); // ZTextFields line border color
|
||||
|
||||
public static final Font ZLabelFont=new Font(Global.GlobalFont, 0, 11);
|
||||
public static final Font ZCheckBoxFont=new Font(Global.GlobalFont, 0, 11);
|
||||
public static final Font ZTextFieldFont=new Font(Global.GlobalFont, 0, 11);
|
||||
public static final Font ZDialogTitleFont=new Font(Global.GlobalFont, 1, 12);
|
||||
|
||||
|
||||
public static void fixsize(JComponent jc, int w, int h) {
|
||||
Dimension d=new Dimension(w, h);
|
||||
jc.setSize(d);
|
||||
jc.setMaximumSize(d);
|
||||
jc.setMinimumSize(d);
|
||||
jc.setPreferredSize(d);
|
||||
}
|
||||
}
|
BIN
eric/GUI/icons/.DS_Store
vendored
Normal file
BIN
eric/GUI/icons/bar/aimant.png
Normal file
After Width: | Height: | Size: 863 B |
BIN
eric/GUI/icons/bar/aimantON.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
eric/GUI/icons/bar/angle0.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle1.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle2.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle3.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/bold.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
eric/GUI/icons/bar/carbtn.png
Normal file
After Width: | Height: | Size: 700 B |
BIN
eric/GUI/icons/bar/carbtn_dis.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
eric/GUI/icons/bar/cblack.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cblue.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cbrown.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/ccyan.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cgreen.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/chidden.png
Normal file
After Width: | Height: | Size: 612 B |
BIN
eric/GUI/icons/bar/cnormal.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
eric/GUI/icons/bar/cod0.png
Normal file
After Width: | Height: | Size: 228 B |
BIN
eric/GUI/icons/bar/cod1.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
eric/GUI/icons/bar/cod2.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
eric/GUI/icons/bar/cod3.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
eric/GUI/icons/bar/cod4.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
eric/GUI/icons/bar/cod5.png
Normal file
After Width: | Height: | Size: 409 B |
BIN
eric/GUI/icons/bar/cod6.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
eric/GUI/icons/bar/color0.png
Normal file
After Width: | Height: | Size: 633 B |
BIN
eric/GUI/icons/bar/color1.png
Normal file
After Width: | Height: | Size: 658 B |
BIN
eric/GUI/icons/bar/color2.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color3.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color4.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color5.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/cred.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cshowname.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
eric/GUI/icons/bar/cshowvalue.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
eric/GUI/icons/bar/csolid.png
Normal file
After Width: | Height: | Size: 794 B |
BIN
eric/GUI/icons/bar/csuperhidden.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
eric/GUI/icons/bar/cthick.png
Normal file
After Width: | Height: | Size: 694 B |
BIN
eric/GUI/icons/bar/cthin.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
eric/GUI/icons/bar/filled.png
Normal file
After Width: | Height: | Size: 1,007 B |
BIN
eric/GUI/icons/bar/fnct.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
eric/GUI/icons/bar/hide.png
Normal file
After Width: | Height: | Size: 902 B |
BIN
eric/GUI/icons/bar/large.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
eric/GUI/icons/bar/obtuse.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
eric/GUI/icons/bar/open_left.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
eric/GUI/icons/bar/open_right.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
eric/GUI/icons/bar/partial.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/plines.png
Normal file
After Width: | Height: | Size: 975 B |
BIN
eric/GUI/icons/bar/showname.png
Normal file
After Width: | Height: | Size: 751 B |
BIN
eric/GUI/icons/bar/showvalue.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
eric/GUI/icons/bar/solid.png
Normal file
After Width: | Height: | Size: 1,000 B |
BIN
eric/GUI/icons/bar/thickness0.png
Normal file
After Width: | Height: | Size: 281 B |
BIN
eric/GUI/icons/bar/thickness1.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
eric/GUI/icons/bar/thickness2.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
eric/GUI/icons/bar/thickness3.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
eric/GUI/icons/bar/type0.png
Normal file
After Width: | Height: | Size: 543 B |
BIN
eric/GUI/icons/bar/type1.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
eric/GUI/icons/bar/type2.png
Normal file
After Width: | Height: | Size: 862 B |
BIN
eric/GUI/icons/bar/type3.png
Normal file
After Width: | Height: | Size: 346 B |
BIN
eric/GUI/icons/bar/type4.png
Normal file
After Width: | Height: | Size: 758 B |
BIN
eric/GUI/icons/bar/type5.png
Normal file
After Width: | Height: | Size: 929 B |
BIN
eric/GUI/icons/jswindow/.DS_Store
vendored
Normal file
BIN
eric/GUI/icons/jswindow/comment.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
eric/GUI/icons/jswindow/error.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
eric/GUI/icons/jswindow/format.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
eric/GUI/icons/jswindow/french.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
eric/GUI/icons/jswindow/french2.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
eric/GUI/icons/jswindow/help.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
eric/GUI/icons/jswindow/js.png
Normal file
After Width: | Height: | Size: 791 B |
BIN
eric/GUI/icons/jswindow/js2.png
Normal file
After Width: | Height: | Size: 884 B |
BIN
eric/GUI/icons/jswindow/restore.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
eric/GUI/icons/jswindow/run.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
eric/GUI/icons/palette/.DS_Store
vendored
Normal file
BIN
eric/GUI/icons/palette/Mcancel.png
Normal file
After Width: | Height: | Size: 811 B |
BIN
eric/GUI/icons/palette/Mvalid.png
Normal file
After Width: | Height: | Size: 765 B |
BIN
eric/GUI/icons/palette/PaletteTriangleBas.png
Normal file
After Width: | Height: | Size: 184 B |
BIN
eric/GUI/icons/palette/PaletteTriangleDroite.png
Normal file
After Width: | Height: | Size: 189 B |
BIN
eric/GUI/icons/palette/acolor0.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
eric/GUI/icons/palette/acolor1.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
eric/GUI/icons/palette/acolor2.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
eric/GUI/icons/palette/acolor3.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
eric/GUI/icons/palette/acolor4.png
Normal file
After Width: | Height: | Size: 523 B |
BIN
eric/GUI/icons/palette/acolor5.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
eric/GUI/icons/palette/allback.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
eric/GUI/icons/palette/allforward.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
eric/GUI/icons/palette/angle.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
eric/GUI/icons/palette/angle0.gif
Normal file
After Width: | Height: | Size: 475 B |
BIN
eric/GUI/icons/palette/angle1.gif
Normal file
After Width: | Height: | Size: 496 B |
BIN
eric/GUI/icons/palette/angle2.gif
Normal file
After Width: | Height: | Size: 502 B |
BIN
eric/GUI/icons/palette/angle3.gif
Normal file
After Width: | Height: | Size: 546 B |