@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == checkAllButton) { for (int i = 0; i < numItems; i++) { chooseCB[i].setSelected(true); } } if (ev.getSource() == clearAllButton) { for (int i = 0; i < numItems; i++) { chooseCB[i].setSelected(false); } } if (ev.getSource() == titleColorButton) { Color newColor = JColorChooser.showDialog(this, "Select color", titleColorButton.getBackground()); if (newColor != null) { titleColorButton.setBackground(newColor); } } if (ev.getSource() == textColorButton) { Color newColor = JColorChooser.showDialog(this, "Select color", textColorButton.getBackground()); if (newColor != null) { textColorButton.setBackground(newColor); } } if (ev.getSource() == borderColorButton) { Color newColor = JColorChooser.showDialog(this, "Select color", borderColorButton.getBackground()); if (newColor != null) { borderColorButton.setBackground(newColor); } } }
/** * Cr�e une nouvelle instance de CreeTrans * * @param mf fenetre principale de l'application * @param zg Zone graphique * @param auto automate * @param be barre d'�tat */ public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) { super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true); this.setResizable(false); this.gz = g; this.auto = auto; this.bar = be; this.mf = mf; be.displayInfo("Creating interaction"); tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel1.setBackground(Color.lightGray); tfJPanel1.add(new JLabel("Type : ")); groupe = new CheckboxGroup(); plus = new Checkbox("activator", groupe, true); tfJPanel1.add(plus); minus = new Checkbox("inhibitor", groupe, false); tfJPanel1.add(minus); tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel2.setBackground(Color.lightGray); tfJPanel2.add(new JLabel("Threshold = ")); tf = new JTextField(auto.nbrCharTransLabel); tf.setText("1"); tfJPanel2.add(tf); btJPanel = new JPanel(new GridLayout(1, 2, 0, 0)); btJPanel.setBackground(Color.lightGray); ok = new Button("Ok"); ok.setBackground(Color.lightGray); ok.addActionListener(this); cancel = new Button("Cancel"); cancel.setBackground(Color.lightGray); cancel.addActionListener(this); btJPanel.add(ok); btJPanel.add(cancel); content = this.getContentPane(); content.setLayout(new BorderLayout()); content.setBackground(Color.lightGray); content.add(tfJPanel1, BorderLayout.NORTH); content.add(tfJPanel2, BorderLayout.CENTER); content.add(btJPanel, BorderLayout.SOUTH); this.pack(); this.setLocationRelativeTo(this.mf); tf.requestFocusInWindow(); // rendre la fenetre visible setVisible(true); }
public void addDays() { this.removeAll(); this.panel.removeAll(); for (int i = 1; i <= this.model.getMaxDays(); i++) { Button button = new Button(i + ""); button.setEnabled(false); boolean isBlack = false; for (Integer integer : this.model.getList()) { if (integer.equals(i)) { isBlack = true; button.setBackground(Color.BLACK); button.addActionListener( new DayController(this.db, this.model.getPictures(i), this.files)); button.setActionCommand("Day"); this.revalidate(); } else { } } button.setVisible(true); if (isBlack) { button.setEnabled(true); } this.panel.add(button); this.add(this.panel, BorderLayout.CENTER); revalidate(); } revalidate(); }
public Button designButton(Button b) { Border emptyBorder = BorderFactory.createEmptyBorder(); b.setFocusable(false); b.setFont(new Font("Tahoma", Font.BOLD, 12)); b.setForeground(Color.WHITE); b.setBackground(Color.DARK_GRAY); return b; }
private void initcomp() { this.setLayout(null); this.setLocation(249, 135); this.setSize(300, 400); this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); this.add(btn1); this.add(btn2); this.add(btn3); btn1.setBounds(50, 50, 50, 100); btn2.setBounds(200, 50, 50, 100); btn3.setBounds(50, 200, 200, 50); btn1.setBackground(Color.CYAN); btn2.setBackground(Color.BLACK); btn2.setForeground(Color.WHITE); btn3.setBackground(Color.YELLOW); this.setTitle(Integer.toString(i)); btn1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub i++; ct(); } }); btn2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub i--; ct(); } }); btn3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub System.exit(0); } }); }
/** * Initialize the contents of the frame. * * @throws IOException */ private void initialize() throws IOException { frmGomoku = new JFrame(); frmGomoku.setTitle("GOMOKU"); frmGomoku.setBounds(150, 20, 1000, 670); frmGomoku.setResizable(false); frmGomoku.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frmGomoku.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { try { listener.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); frmGomoku.getContentPane().add(layeredPane); setLayeredPane(); JLabel lblGomoku = DefaultComponentFactory.getInstance().createTitle("G . O . M . O . K . U"); lblGomoku.setFont(new Font("Roboto", Font.BOLD, 20)); lblGomoku.setBounds(425, 11, 205, 38); layeredPane.add(lblGomoku); textField = new TextField(); textField.setBounds(764, 27, 182, 22); layeredPane.add(textField); textField_1 = new TextField(); textField_1.setBounds(764, 74, 182, 22); layeredPane.add(textField_1); button = new Button("Maiin"); button.setBackground(Color.WHITE); button.setBounds(764, 106, 105, 22); layeredPane.add(button); Label label = new Label("Nama"); label.setBounds(689, 27, 62, 22); layeredPane.add(label); Label label_1 = new Label("Nama room"); label_1.setBounds(689, 74, 69, 22); layeredPane.add(label_1); lblGiiliran = DefaultComponentFactory.getInstance().createLabel(""); lblGiiliran.setFont(new Font("Tahoma", Font.BOLD, 15)); lblGiiliran.setBounds(689, 221, 257, 22); layeredPane.add(lblGiiliran); lblRoom = DefaultComponentFactory.getInstance().createLabel(""); lblRoom.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblRoom.setBounds(689, 170, 257, 22); layeredPane.add(lblRoom); listener = new ServerSocket(PORT); }
public void init() { Button button1 = new Button("Button 1"); Button button2 = new Button("Button 1"); Button button3 = new Button("Button 1"); Font myFont = new Font("Courier", Font.ITALIC, 12); button1.setFont(myFont); button1.setForeground(Color.black); button2.setForeground(Color.blue); button1.setBackground(Color.red); button2.setBackground(Color.green); this.add(button1); this.add(button2); this.add(button3); isButton1Visible = button1.isVisible(); isButton2Visible = button2.isVisible(); }
Panel2(web main) { setLayout(new GridLayout(1, 2)); main.par = new TextArea(); main.par.setEditable(false); main.par.setBackground(Color.black); main.par.setForeground(Color.lightGray); add(main.par); button = new Button("start"); button.setBackground(Color.black); button.setForeground(Color.blue); button.setFont(new Font("Default", Font.PLAIN, 32)); add(button); button.addActionListener(main); }
/** Creates new HelpBox */ public HelpBox() { super(new Frame(), " Help ", false); this.setBackground(Color.white); this.setLayout(new BorderLayout()); helpTextArea = new TextArea(); helpTextArea.setEditable(false); // fill the help box helpTextArea.append( "National Institute of Standards and Technology\n" + "========================================\n" + "\n" + "NIST-SIP Trace viewer 1.1\n" + "========================================\n" + "\n" + "\n" + " Hit refresh to get new trace data from the proxy. \n" + "If no traces appear at all, you should check if the proxy is started.\n" + "Once some SIP sessions are available, you can click directly on \n" + "an arrow representing a SIP message of your \n" + "choice, and see the text of the chosen SIP message. \n" + "If any small yellow bubbles appear on the top right of the SIP message, \n" + "you can click on it and see some extra informations logged by the proxy.\n" + "\n" + "\n" + "If you experience any problems please contact:\n" + "[email protected]\n" + "\n"); ok = new Button(" Ok "); ok.setBackground(Color.lightGray); ok.setForeground(Color.black); this.add(helpTextArea, BorderLayout.CENTER); this.add(ok, BorderLayout.SOUTH); ok.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { setVisible(false); } }); this.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { setVisible(false); } }); // width, height this.setSize(400, 400); }
private void initComponents() { btLogin.setFocusable(false); // Fókusz letiltása btSettings.setFocusable(false); // Fókusz letiltása btLogin.setBackground(Color.lightGray); // A "bejelentkezés" gomb háttérszínének beállítása btSettings.setBackground( pnLogin.getBackground()); // A "Beállítások" gomb háttérszínének beállítása tfUsername.setPreferredSize(new Dimension(120, 25)); // Szövegmező átméretezése pfPassword.setPreferredSize(new Dimension(120, 25)); // Jelszómező átméretezése tfUsername.addKeyListener(btEnabler); // A figyelő hozzáadása a felhasználónév mezőhőz pfPassword.addKeyListener(btEnabler); // A figyelő hozzáadása a jelszó mezőhőz }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private java.awt.Button getDetailsButton() { if (ivjDetailsButton == null) { try { ivjDetailsButton = new java.awt.Button(); ivjDetailsButton.setName("DetailsButton"); ivjDetailsButton.setLocation(33, 170); ivjDetailsButton.setBackground(java.awt.SystemColor.control); ivjDetailsButton.setSize(23, 23); ivjDetailsButton.setFont(new java.awt.Font("dialog", 0, 8)); ivjDetailsButton.setActionCommand("..."); ivjDetailsButton.setLabel("..."); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } ; return ivjDetailsButton; }
public void init() { showStatus("init"); System.out.println("init"); this.setSize(180, 250); dec = 0; currentNumber = 0; decimalNumber = 0; // ############################################## No0 = new Button("0"); No0.setBounds(50, 210, 40, 40); No0.setBackground(new Color(0, 100, 200)); No1 = new Button("1"); No1.setBounds(10, 90, 40, 40); No1.setBackground(new Color(0, 100, 200)); No2 = new Button("2"); No2.setBounds(50, 90, 40, 40); No2.setBackground(new Color(0, 100, 200)); No3 = new Button("3"); No3.setBounds(90, 90, 40, 40); No3.setBackground(new Color(0, 100, 200)); No4 = new Button("4"); No4.setBounds(10, 130, 40, 40); No4.setBackground(new Color(0, 100, 200)); No5 = new Button("5"); No5.setBounds(50, 130, 40, 40); No5.setBackground(new Color(0, 100, 200)); No6 = new Button("6"); No6.setBounds(90, 130, 40, 40); No6.setBackground(new Color(0, 100, 200)); No7 = new Button("7"); No7.setBounds(10, 170, 40, 40); No7.setBackground(new Color(0, 100, 200)); No8 = new Button("8"); No8.setBounds(50, 170, 40, 40); No8.setBackground(new Color(0, 100, 200)); No9 = new Button("9"); No9.setBounds(90, 170, 40, 40); No9.setBackground(new Color(0, 100, 200)); // ############################################## add = new Button("+"); add.setBounds(130, 90, 40, 40); add.setBackground(new Color(20, 250, 50)); sub = new Button("-"); sub.setBounds(130, 130, 40, 40); sub.setBackground(new Color(20, 250, 50)); mul = new Button("x"); mul.setBounds(130, 170, 40, 40); mul.setBackground(new Color(20, 250, 50)); div = new Button("/"); div.setBounds(130, 210, 40, 40); div.setBackground(new Color(20, 250, 50)); squ = new Button("x²"); squ.setBounds(50, 50, 40, 40); squ.setBackground(new Color(20, 120, 50)); cube = new Button("x³"); cube.setBounds(90, 50, 40, 40); cube.setBackground(new Color(20, 120, 50)); squRoot = new Button("//"); /* √ */ squRoot.setBounds(130, 50, 40, 40); squRoot.setBackground(new Color(20, 120, 50)); // ############################################## equ = new Button("="); equ.setBounds(90, 210, 40, 40); equ.setBackground(new Color(20, 250, 50)); decimal = new Button("//"); decimal.setBounds(10, 210, 40, 40); decimal.setBackground(new Color(20, 250, 50)); clr = new Button("Clr-All"); clr.setBounds(10, 50, 40, 40); clr.setBackground(new Color(200, 50, 15)); // ############################################## add(No1); add(No2); add(No3); add(No4); add(No5); add(No6); add(No7); add(No8); add(No9); add(No0); // ############################################## add(add); add(sub); add(mul); add(div); add(squ); add(cube); add(squRoot); // ############################################## add(equ); add(decimal); add(clr); // ############################################## No0.addActionListener(this); No1.addActionListener(this); No2.addActionListener(this); No3.addActionListener(this); No4.addActionListener(this); No5.addActionListener(this); No6.addActionListener(this); No7.addActionListener(this); No8.addActionListener(this); No9.addActionListener(this); // ############################################## add.addActionListener(this); sub.addActionListener(this); mul.addActionListener(this); div.addActionListener(this); squ.addActionListener(this); cube.addActionListener(this); // ############################################## equ.addActionListener(this); decimal.addActionListener(this); clr.addActionListener(this); // ############################################## addKeyListener(this); setLayout(null); }
public CalculatorSergii() { f = new Frame("Calculator"); b1 = new Button("7"); b2 = new Button("8"); b3 = new Button("9"); b4 = new Button("*"); b5 = new Button("sqrt;"); b6 = new Button("4"); b7 = new Button("5"); b8 = new Button("6"); b9 = new Button("/"); b10 = new Button("del"); b11 = new Button("1"); b12 = new Button("2"); b13 = new Button("3"); b14 = new Button("-"); b15 = new Button("1/x "); b16 = new Button("0"); b17 = new Button("."); b18 = new Button("C"); b19 = new Button("+"); b20 = new Button("="); b18.setBackground(Color.white); b10.setBackground(Color.white); b20.setBackground(Color.gray); b15.setBackground(Color.gray); b5.setBackground(Color.gray); b9.setBackground(Color.lightGray); b19.setBackground(Color.lightGray); b14.setBackground(Color.lightGray); b4.setBackground(Color.lightGray); f.addWindowListener(this); tf = new TextField("0"); // работа кнопок-цифр b11.addActionListener(this); b12.addActionListener(this); b13.addActionListener(this); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b6.addActionListener(this); b7.addActionListener(this); b8.addActionListener(this); b16.addActionListener(this); // работа кнопки С b18.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { tf.setText("0"); zn = 0; check = true; } }); // возможность ставить точки в числе после арифм. знака b17.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (tf.getText().indexOf('.') == -1) tf.setText(tf.getText() + e.getActionCommand()); } }); // возможность ставить только один + b19.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (arifm == false) { if (zn == 0) { operand = Double.parseDouble(tf.getText()); check = true; } else { if (zn == 1) operand = operand + Double.parseDouble(tf.getText()); if (zn == 2) operand = operand * Double.parseDouble(tf.getText()); if (zn == 3) operand = operand / Double.parseDouble(tf.getText()); if (zn == 4) operand = operand - Double.parseDouble(tf.getText()); } tf.setText(operand + ""); check = true; arifm = true; zn = 1; } else zn = 1; } }); // /--/ * b4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (arifm == false) { if (zn == 0) { operand = Double.parseDouble(tf.getText()); check = true; } else { if (zn == 1) operand = operand + Double.parseDouble(tf.getText()); if (zn == 2) operand = operand * Double.parseDouble(tf.getText()); if (zn == 3) operand = operand / Double.parseDouble(tf.getText()); if (zn == 4) operand = operand - Double.parseDouble(tf.getText()); } tf.setText(operand + ""); check = true; arifm = true; zn = 2; } else zn = 2; } }); // /--/ / b9.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (arifm == false) { if (zn == 0) { operand = Double.parseDouble(tf.getText()); check = true; } else { if (zn == 1) operand = operand + Double.parseDouble(tf.getText()); if (zn == 2) operand = operand * Double.parseDouble(tf.getText()); if (zn == 3) operand = operand / Double.parseDouble(tf.getText()); if (zn == 4) operand = operand - Double.parseDouble(tf.getText()); } tf.setText(operand + ""); check = true; arifm = true; zn = 3; } else zn = 3; } }); // /--/ - b14.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (arifm == false) { if (zn == 0) { operand = Double.parseDouble(tf.getText()); check = true; } else { if (zn == 1) operand = operand + Double.parseDouble(tf.getText()); if (zn == 2) operand = operand * Double.parseDouble(tf.getText()); if (zn == 3) operand = operand / Double.parseDouble(tf.getText()); if (zn == 4) operand = operand - Double.parseDouble(tf.getText()); } tf.setText(operand + ""); check = true; arifm = true; zn = 4; } else zn = 4; } }); // операции при нажатии кнопки = b20.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (zn != 0 && arifm != true) { if (zn == 1) operand = operand + Double.parseDouble(tf.getText()); if (zn == 2) operand = operand * Double.parseDouble(tf.getText()); if (zn == 3) operand = operand / Double.parseDouble(tf.getText()); if (zn == 4) operand = operand - Double.parseDouble(tf.getText()); tf.setText(operand + ""); } zn = 0; } }); }
public RedigerKategori() { this.setBackground(new Color(51, 161, 201)); setLayout(null); JLabel TilføjKategori = new JLabel("Rediger Kategori"); TilføjKategori.setIcon( new ImageIcon(TilføjVare.class.getResource("/presentation/resources/add32.png"))); TilføjKategori.setFont(new Font("sansserif", Font.BOLD, 24)); TilføjKategori.setForeground(Color.black); TilføjKategori.setBounds(30, 30, 250, 30); this.add(TilføjKategori); JLabel TilføjKategorinavn = new JLabel("Kategorinavn:"); TilføjKategorinavn.setFont(new Font("Tahoma", Font.PLAIN, 12)); TilføjKategorinavn.setBounds(140, 90, 140, 20); TilføjKategorinavn.setForeground(Color.black); add(TilføjKategorinavn); kategorinavnText = new JTextField(); kategorinavnText.setBounds(230, 90, 300, 20); add(kategorinavnText); Button sletKategori = new Button("Slet"); sletKategori.setBackground(new Color(255, 215, 10)); sletKategori.setBounds(380, 160, 70, 22); sletKategori.setForeground(Color.black); add(sletKategori); sletKategori.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { controller.slet(); } }); Button TilføjKategori1 = new Button("Gem"); TilføjKategori1.setBackground(new Color(255, 215, 10)); TilføjKategori1.setBounds(460, 160, 70, 22); TilføjKategori1.setForeground(Color.black); add(TilføjKategori1); Ktable1 = new JTable(); Ktable1.setBounds(12, 10, 710, 57); Ktable1.setBackground(new Color(238, 238, 238)); add(Ktable1); JLabel TilføjOverKategori = new JLabel("Over kategori:"); TilføjOverKategori.setFont(new Font("Tahoma", Font.PLAIN, 12)); TilføjOverKategori.setBounds(140, 120, 140, 20); TilføjOverKategori.setForeground(Color.black); add(TilføjOverKategori); TilføjKategori1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.out.println(controller); controller.updateKategori(kategorinavnText, combobox1); } }); combobox1 = new JComboBox<String>(); combobox1.setBounds(230, 120, 300, 20); add(combobox1); Ktable = new JTable(); Ktable.setBounds(12, 71, 710, 405); Ktable.setBackground(new Color(238, 238, 238)); add(Ktable); }
public void init() { GridBagDesigner gb = new GridBagDesigner(this); /* showCB = new JCheckBox(iPlug.get("JumpPrinter.Furniture.Show")); gb.setPosition(0,0); gb.setAnchor(GridBagConstraints.WEST); gb.setInsets(10,5,0,0); gb.addComponent(showCB); showCB.setSelected(legend.show); checkAllButton = new JButton(iPlug.get("JumpPrinter.Furniture.Legend.CheckAll")); gb.setPosition(1,0); gb.setInsets(10,5,0,0); gb.setSpan(2,1); gb.addComponent(checkAllButton); checkAllButton.addActionListener(this); clearAllButton = new JButton(iPlug.get("JumpPrinter.Furniture.Legend.ClearAll")); gb.setPosition(3,0); gb.setInsets(10,5,0,0); gb.setWeight(0.0,0.0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(clearAllButton); clearAllButton.addActionListener(this); colorButton = new ColorButton(legend); gb.setPosition(4,0); gb.setInsets(10,10,0,0); gb.setAnchor(GridBagConstraints.WEST); gb.setWeight(1.0,0.0); gb.addComponent(colorButton); borderCB = new JCheckBox(iPlug.get("JumpPrinter.Furniture.Legend.Border")); gb.setPosition(0,1); gb.setInsets(10,5,0,0); //gb.setWeight(1.0,0.0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(borderCB); borderCB.setSelected(legend.border); JLabel sizeLabel = new JLabel(iPlug.get("JumpPrinter.Furniture.Note.Size")); gb.setPosition(1,1); gb.setAnchor(GridBagConstraints.EAST); gb.setInsets(10,5,0,0); gb.addComponent(sizeLabel); sizeCombo = new JComboBox(sizeItems); gb.setPosition(2,1); gb.setInsets(10,0,0,0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(sizeCombo); sizeCombo.setSelectedItem(String.valueOf(legend.size)); */ showCB = new JCheckBox(iPlug.get("JumpPrinter.Furniture.Show")); gb.setPosition(0, 0); gb.setAnchor(GridBagConstraints.WEST); gb.setInsets(10, 5, 0, 0); gb.addComponent(showCB); showCB.setSelected(legend.show); titleLabel = new JLabel(iPlug.get("JumpPrinter.Furniture.Title.Title")); gb.setPosition(1, 0); gb.setInsets(10, 5, 0, 0); gb.addComponent(titleLabel); titleField = new JTextField(20); gb.setPosition(2, 0); gb.setInsets(10, 5, 0, 0); gb.setSpan(4, 1); gb.setFill(GridBagConstraints.HORIZONTAL); gb.addComponent(titleField); titleField.setText(legend.legendName); showTitleCB = new JCheckBox(iPlug.get("JumpPrinter.Furniture.Title.Title")); gb.setPosition(6, 0); gb.setInsets(10, 5, 0, 0); gb.addComponent(showTitleCB); showTitleCB.setSelected(legend.showTitle); titleColorButton = new Button(" "); titleColorButton.setBackground(legend.legendTitleColor); gb.setPosition(7, 0); gb.setInsets(10, 0, 0, 10); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(titleColorButton); titleColorButton.addActionListener(this); fontLabel = new JLabel(iPlug.get("JumpPrinter.Furniture.Title.Font")); gb.setPosition(0, 1); gb.setInsets(5, 10, 0, 0); gb.addComponent(fontLabel); fontNameCombo = new JComboBox( GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); gb.setPosition(1, 1); gb.setInsets(5, 0, 0, 0); gb.setAnchor(GridBagConstraints.WEST); gb.setSpan(3, 1); gb.addComponent(fontNameCombo); fontSizeCombo = new JComboBox(sizeItems); gb.setPosition(4, 1); gb.setInsets(5, 0, 0, 0); gb.setAnchor(GridBagConstraints.WEST); gb.setFill(GridBagConstraints.HORIZONTAL); gb.addComponent(fontSizeCombo); fontStyleCombo = new JComboBox(styles); gb.setPosition(5, 1); gb.setInsets(5, 0, 0, 0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(fontStyleCombo); textColorButton = new Button(" "); textColorButton.setBackground(legend.legendTextColor); gb.setPosition(7, 1); gb.setInsets(5, 0, 0, 10); gb.setAnchor(GridBagConstraints.WEST); gb.setWeight(1.0, 0.0); gb.addComponent(textColorButton); textColorButton.addActionListener(this); borderCB = new JCheckBox(iPlug.get("JumpPrinter.Furniture.Legend.Border")); gb.setPosition(6, 2); gb.setInsets(5, 0, 0, 0); // gb.setWeight(1.0,0.0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(borderCB); borderCB.setSelected(legend.border); borderColorButton = new Button(" "); borderColorButton.setBackground(legend.legendBorderColor); gb.setPosition(7, 2); gb.setInsets(5, 0, 0, 10); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(borderColorButton); borderColorButton.addActionListener(this); checkAllButton = new JButton(iPlug.get("JumpPrinter.Furniture.Legend.CheckAll")); gb.setPosition(0, 2); gb.setInsets(10, 0, 0, 0); gb.addComponent(checkAllButton); checkAllButton.addActionListener(this); clearAllButton = new JButton(iPlug.get("JumpPrinter.Furniture.Legend.ClearAll")); gb.setPosition(1, 2); gb.setInsets(10, 0, 0, 0); gb.setWeight(0.0, 0.0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(clearAllButton); clearAllButton.addActionListener(this); layerLabel = new JLabel(iPlug.get("JumpPrinter.Furniture.Layer")); gb.setPosition(2, 2); gb.setInsets(10, 10, 10, 0); gb.addComponent(layerLabel); layerField = new JTextField(5); gb.setPosition(3, 2); gb.setInsets(10, 5, 10, 0); gb.addComponent(layerField); layerField.setText(String.valueOf(legend.layerNumber)); vertRB = new JRadioButton(iPlug.get("JumpPrinter.Furniture.Vertical")); gb.setPosition(4, 2); gb.setInsets(0, 0, 0, 0); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(vertRB); horRB = new JRadioButton(iPlug.get("JumpPrinter.Furniture.Horizontal")); gb.setPosition(5, 2); gb.setInsets(0, 0, 0, 10); gb.setAnchor(GridBagConstraints.WEST); gb.addComponent(horRB); bgroup = new ButtonGroup(); bgroup.add(vertRB); bgroup.add(horRB); if (legend.horizontal) { horRB.setSelected(true); } else { vertRB.setSelected(true); } chooseCB = new JCheckBox[numItems]; listPanel = new JPanel(); GridBagDesigner gbl = new GridBagDesigner(listPanel); for (int i = 0; i < numItems; i++) { gbl.setPosition(0, i); gbl.setWeight(1.0, 0.0); gbl.setAnchor(GridBagConstraints.WEST); chooseCB[i] = new JCheckBox(legend.legendItems.elementAt(i).name); chooseCB[i].setSelected(legend.legendItems.elementAt(i).include); gbl.addComponent(chooseCB[i]); } scrollPane = new JScrollPane(listPanel); scrollPane.setPreferredSize(new Dimension(300, 150)); gb.setPosition(0, 3); gb.setFill(GridBagConstraints.BOTH); gb.setWeight(1.0, 1.0); gb.setSpan(8, 1); gbl.setAnchor(GridBagConstraints.WEST); gb.addComponent(scrollPane); }
public void execute_TestCase2() throws Exception { setUndecorated(true); setRootPaneCheckingEnabled(false); setForeground(Color.BLACK); setBackground(Color.WHITE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 774, 353); setLocationRelativeTo(null); setVisible(true); contentPane = new JPanel(); contentPane.setFocusCycleRoot(true); contentPane.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION); contentPane.setBounds(new Rectangle(100, 100, 130, 100)); contentPane.setBackground(Color.WHITE); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblEnterThePath = new JLabel("Select Path of Working Folder"); lblEnterThePath.setForeground(new Color(128, 128, 128)); lblEnterThePath.setFont(new Font("Tahoma", Font.BOLD, 11)); lblEnterThePath.setBackground(new Color(0, 0, 0)); lblEnterThePath.setBounds(63, 104, 187, 31); contentPane.add(lblEnterThePath); txtHello = new JTextField(); txtHello.setName(""); txtHello.setBounds(271, 104, 296, 31); txtHello.setEditable(false); contentPane.add(txtHello); txtHello.setColumns(10); JLabel lblSelectPathOf = new JLabel("Select Path of Configuration File"); lblSelectPathOf.setForeground(new Color(128, 128, 128)); lblSelectPathOf.setFont(new Font("Tahoma", Font.BOLD, 11)); lblSelectPathOf.setBounds(63, 149, 187, 28); contentPane.add(lblSelectPathOf); textField_1 = new JTextField(); textField_1.setBounds(271, 146, 296, 31); textField_1.setEditable(false); contentPane.add(textField_1); textField_1.setColumns(10); JLabel lblWelcomeToVitalhealth = new JLabel("Welcome to VitalHealth Test Automation Framework"); lblWelcomeToVitalhealth.setHorizontalTextPosition(SwingConstants.CENTER); lblWelcomeToVitalhealth.setForeground(new Color(128, 128, 128)); lblWelcomeToVitalhealth.setFont(new Font("Tahoma", Font.BOLD, 14)); lblWelcomeToVitalhealth.setHorizontalAlignment(SwingConstants.CENTER); lblWelcomeToVitalhealth.setBackground(Color.BLACK); lblWelcomeToVitalhealth.setBounds(191, 22, 465, 34); contentPane.add(lblWelcomeToVitalhealth); Button button = new Button("Browse"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { showOpenFileDialog(); } }); button.setForeground(Color.WHITE); button.setFont(new Font("Dialog", Font.BOLD, 12)); button.setBackground(new Color(51, 153, 255)); button.setBounds(573, 104, 113, 31); contentPane.add(button); Button button_1 = new Button("Browse"); button_1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { showOpenFileDialog1(); } }); button_1.setForeground(Color.WHITE); button_1.setFont(new Font("Dialog", Font.BOLD, 12)); button_1.setBackground(new Color(51, 153, 255)); button_1.setBounds(573, 146, 113, 31); contentPane.add(button_1); Button button_2 = new Button("RUN TEST"); button_2.setForeground(Color.WHITE); button_2.setFont(new Font("Dialog", Font.BOLD, 12)); button_2.setBackground(new Color(30, 144, 255)); button_2.setBounds(63, 205, 623, 34); contentPane.add(button_2); Button button_3 = new Button("DOWNLOAD SAMPLE EXCEL WEB"); button_3.setActionCommand("DOWNLOAD SAMPLE EXCEL WEB"); button_3.setForeground(new Color(128, 128, 128)); button_3.setFont(new Font("Dialog", Font.BOLD, 12)); button_3.setBackground(Color.WHITE); button_3.setBounds(564, 309, 200, 34); contentPane.add(button_3); Button button_4 = new Button("DOWNLOAD SAMPLE EXCEL MOBILE"); button_4.setForeground(new Color(128, 128, 128)); button_4.setFont(new Font("Dialog", Font.BOLD, 12)); button_4.setBackground(Color.WHITE); button_4.setActionCommand("DOWNLOAD SAMPLE EXCEL MOBILE"); button_4.setBounds(23, 309, 227, 34); contentPane.add(button_4); JLabel icon = new JLabel(""); Image img = new ImageIcon(this.getClass().getResource("/VitalHealth.png")).getImage(); icon.setIcon(new ImageIcon(img)); icon.setBounds(23, 11, 173, 71); contentPane.add(icon); // L1 l1 = new L1(); L2 l2 = new L2(); button_4.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameMobile)); button_3.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameWeb)); button_2.addActionListener(l2); }