/* A basic implementation of the JFrame class. */ package application.draw; import java.awt.Dimension; import java.awt.Font; import java.awt.Insets; import java.net.URL; import java.util.Vector; import javax.swing.ImageIcon; import controlledparts.*; public class WidthSelectFrame extends javax.swing.JFrame implements FrameWithControlledButton, StateContainer { public boolean isDirectOperation() { return draw.isDirectOperation(); } public int getState() { return this.currentState; } public int currentState; public void setState(int i) { ControlledButton b=(ControlledButton)(buttons.elementAt(i)); draw.lineWidthSelectButton.setIcon(b.getIcon()); draw.lineWidthSelectButton.setText(b.getText()); draw.lineWidthSelectButton.repaint(); draw.editdispatch.changeWidth(); this.currentState=i; } public boolean isControlledByLocalUser() { // This method is derived from interface FrameWithControlledButton // to do: code goes here return draw.isControlledByLocalUser(); } public void sendEvent(String x) { draw.sendEvent("dwidth."+x); } public void clickButton(int i) { ControlledButton b=(ControlledButton)(buttons.elementAt(i)); b.click(); this.mouseClickedAtButton(i); } public void unfocusButton(int i) { SelectedButton button=(SelectedButton)(buttons.elementAt(i)); button.controlledButton_mouseExited(null); } public void focusButton(int i) { SelectedButton button=(SelectedButton)(buttons.elementAt(i)); button.focus(); } Vector buttons; public void mouseExitedAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here // draw.sendEvent("dwidth.btn.exit("+i+")\n"); } public void mouseEnteredAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here // draw.sendEvent("dwidth.btn.enter("+i+")\n"); } public void mouseClickedAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here if(this.closeButton.getID()==i){ this.hide(); return; } this.setState(i); this.hide(); } public DrawFrame draw; public void setDraw(DrawFrame draw) { this.draw=draw; } public void setIcons(String iconPlace){ try{ this.width1.setIcon(new ImageIcon(new URL(iconPlace+"width1.gif"))); this.width2.setIcon(new ImageIcon(new URL(iconPlace+"width2.gif"))); this.width3.setIcon(new ImageIcon(new URL(iconPlace+"width3.gif"))); this.width4.setIcon(new ImageIcon(new URL(iconPlace+"width4.gif"))); this.width5.setIcon(new ImageIcon(new URL(iconPlace+"width5.gif"))); } catch(Exception e){ } } public WidthSelectFrame() { // This code is automatically generated by Visual Cafe when you add // components to the visual environment. It instantiates and initializes // the components. To modify the code, only use code syntax that matches // what Visual Cafe can generate, or Visual Cafe may be unable to back // parse your Java file into its visual environment. //{{INIT_CONTROLS setTitle("Line Width"); getContentPane().setLayout(null); getContentPane().setBackground(new java.awt.Color(204,204,204)); setSize(164,207); setVisible(false); width1.setText("1"); width1.setActionCommand("1"); getContentPane().add(width1); width1.setBackground(new java.awt.Color(204,204,204)); width1.setForeground(java.awt.Color.black); width1.setFont(new Font("Dialog", Font.BOLD, 12)); width1.setBounds(12,12,144,24); width2.setText("2"); width2.setActionCommand("2"); getContentPane().add(width2); width2.setBackground(new java.awt.Color(204,204,204)); width2.setForeground(java.awt.Color.black); width2.setFont(new Font("Dialog", Font.BOLD, 12)); width2.setBounds(12,36,144,24); width3.setText("3"); width3.setActionCommand("3"); getContentPane().add(width3); width3.setBackground(new java.awt.Color(204,204,204)); width3.setForeground(java.awt.Color.black); width3.setFont(new Font("Dialog", Font.BOLD, 12)); width3.setBounds(12,60,144,24); width4.setText("4"); width4.setActionCommand("4"); getContentPane().add(width4); width4.setBackground(new java.awt.Color(204,204,204)); width4.setForeground(java.awt.Color.black); width4.setFont(new Font("Dialog", Font.BOLD, 12)); width4.setBounds(12,84,144,24); width5.setText("5"); width5.setActionCommand("5"); getContentPane().add(width5); width5.setBackground(new java.awt.Color(204,204,204)); width5.setForeground(java.awt.Color.black); width5.setFont(new Font("Dialog", Font.BOLD, 12)); width5.setBounds(12,108,144,24); closeButton.setText("close"); closeButton.setActionCommand("close"); getContentPane().add(closeButton); closeButton.setBackground(new java.awt.Color(204,204,204)); closeButton.setForeground(java.awt.Color.black); closeButton.setFont(new Font("Dialog", Font.BOLD, 12)); closeButton.setBounds(12,144,144,24); //}} //{{INIT_MENUS //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); width1.addActionListener(lSymAction); width2.addActionListener(lSymAction); width3.addActionListener(lSymAction); width4.addActionListener(lSymAction); width5.addActionListener(lSymAction); closeButton.addActionListener(lSymAction); //}} buttons=new Vector(); buttons.addElement(width1); buttons.addElement(width2); buttons.addElement(width3); buttons.addElement(width4); buttons.addElement(width5); buttons.addElement(this.closeButton); int numberOfButtons=buttons.size(); for(int i=0;i