public JButton add(final T key, String buttonText) { JButton editButton = new JButton(buttonText); editButton.setBackground(Color.WHITE); // editButton.setOpaque(true); editButton.setUI(new BasicButtonUI()); editButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); editButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent event) { startEditor(key, (JButton) event.getSource()); } }); ImageIcon icon = new ImageIcon( GraphEditor.class.getResource("/edu/incense/designer/images/remove-icon.png")); JButton removeButton = new JButton(icon); removeButton.setBackground(Color.WHITE); removeButton.setUI(new BasicButtonUI()); removeButton.setSize(ICON_WIDTH, BUTTON_HEIGHT); removeButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent event) { remove(key); } }); JPanel itemPanel = new JPanel(); SpringLayout layout = new SpringLayout(); itemPanel.setLayout(layout); itemPanel.setBackground(Color.WHITE); itemPanel.setBorder(new LineBorder(Color.DARK_GRAY)); itemPanel.add(editButton); itemPanel.add(removeButton); layout.putConstraint(SpringLayout.WEST, editButton, 0, SpringLayout.WEST, itemPanel); layout.putConstraint(SpringLayout.EAST, editButton, 0, SpringLayout.WEST, removeButton); layout.putConstraint(SpringLayout.EAST, removeButton, 0, SpringLayout.EAST, itemPanel); if (items.isEmpty()) removeEmptyMessage(); items.put(key, itemPanel); add(itemPanel); setSize(getPreferredSize()); validate(); // Update container containerWindow.pack(); return editButton; }
/** * Constructor. * * @param title the title of the tab component * @param editor the editor of the tab (used to close the tab) */ public TabComponent(final AbstractEditorPanel editor) { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); setOpaque(false); // title title = new JLabel(editor.getTitle()); title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(title, BorderLayout.WEST); // close final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png")); close.setPreferredSize(new Dimension(16, 16)); close.setUI(new BasicButtonUI()); close.setBorderPainted(false); close.setOpaque(false); close.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeEditor(editor, true); } }); close.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) {} @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) { close.setBorderPainted(true); } @Override public void mouseExited(MouseEvent me) { close.setBorderPainted(false); } }); add(close, BorderLayout.EAST); }
/** * Initialize the contents of the frame. * * @throws UnknownHostException */ private void initialize() throws UnknownHostException { frame = new JFrame("__SERVER__"); frame.setBounds(100, 100, 519, 524); frame.setForeground(Color.RED); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); txtIP = new JTextField(); txtIP.setBounds(29, 11, 86, 20); frame.getContentPane().add(txtIP); txtIP.setColumns(10); InetAddress myHost = InetAddress.getLocalHost(); txtIP.setText(myHost.getHostAddress()); txtPort = new JTextField(); txtPort.setBounds(175, 11, 86, 20); frame.getContentPane().add(txtPort); txtPort.setColumns(10); txtPort.setText("5000"); final JButton StartButtom = new JButton("Start"); StartButtom.setBounds(307, 10, 89, 23); StartButtom.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.blue)); StartButtom.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { if (StartButtom.getText().equals("Start")) { txtIP.disable(); txtPort.disable(); File file = new File("file.txt"); FileReader fr; try { fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line; while ((line = br.readLine()) != null) { String[] s = line.split("__FF__"); FileNode node = new FileNode( s[1], s[2], Long.parseLong(s[3]), s[4], s[5], Integer.parseInt(s[6])); mf.addFile(node); } br.close(); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } StartButtom.setText("Exit"); StartButtom.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.red)); int port = Integer.parseInt(txtPort.getText()); try { startServer(port); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { File file = new File("file.txt"); BufferedWriter out; try { out = new BufferedWriter(new FileWriter(file, true)); for (int i = 0; i < mf.listFile.size(); i++) { out.append( "__FF__" + mf.listFile.get(i).fileName + "__FF__" + mf.listFile.get(i).path + "__FF__" + mf.listFile.get(i).size + "__FF__" + mf.listFile.get(i).userName + "__FF__" + mf.listFile.get(i).IP + "__FF__" + mf.listFile.get(i).port); out.newLine(); } out.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } StartButtom.setText("Start"); System.exit(0); } } }); frame.getContentPane().add(StartButtom); scrollPane = new JScrollPane(); scrollPane.setBounds(287, 125, 109, 164); frame.getContentPane().add(scrollPane); listF = new JList(); scrollPane.setViewportView(listF); JLabel lblServerFile = new JLabel("File To DownLoad"); lblServerFile.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblServerFile.setBounds(71, 73, 151, 20); frame.getContentPane().add(lblServerFile); JLabel lblClientOnline = new JLabel("Client Online"); lblClientOnline.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblClientOnline.setBounds(340, 73, 140, 20); frame.getContentPane().add(lblClientOnline); JLabel lblNotification = new JLabel("Notification:"); lblNotification.setFont(new Font("Tahoma", Font.PLAIN, 13)); lblNotification.setBounds(71, 322, 68, 18); frame.getContentPane().add(lblNotification); final JLabel mauMe = new JLabel("___GVHD: NGUYEN HONG NAM___"); mauMe.setBounds(29, 449, 307, 25); frame.getContentPane().add(mauMe); JScrollPane scrollPane_2 = new JScrollPane(); scrollPane_2.setBounds(71, 341, 341, 97); frame.getContentPane().add(scrollPane_2); scrollPane_2.setViewportView(txtArea); JLabel lblNewLabel = new JLabel("IP:"); lblNewLabel.setBounds(10, 14, 20, 14); frame.getContentPane().add(lblNewLabel); JLabel lblPort = new JLabel("Port:"); lblPort.setBounds(144, 14, 25, 14); frame.getContentPane().add(lblPort); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(10, 104, 221, 197); frame.getContentPane().add(tabbedPane); JPanel panel = new JPanel(); tabbedPane.addTab("Client", null, panel, null); panel.setLayout(null); scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(10, 11, 180, 147); panel.add(scrollPane_1); final JList listClient = new JList(); scrollPane_1.setViewportView(listClient); JPanel panel_1 = new JPanel(); tabbedPane.addTab("Conference", null, panel_1, null); panel_1.setLayout(null); Timer timerUpdateMau = new Timer(); TimerTask ttMau = new TimerTask() { @Override public void run() { if (mauMe.getText().equals("___3D GROUP___")) { mauMe.setForeground(Color.RED); mauMe.setText("___GVHD: NGUYEN HONG NAM___"); } else if (mauMe.getText().equals("___GVHD: NGUYEN HONG NAM___")) { mauMe.setForeground(Color.MAGENTA); mauMe.setText("___PEER TO PEER SERVER___"); } else if (mauMe.getText().equals("___PEER TO PEER SERVER___")) { mauMe.setForeground(Color.BLUE); mauMe.setText("___3D GROUP___"); } } }; timerUpdateMau.schedule(ttMau, 0, 2000); Timer timerUpdateListClient = new Timer(); TimerTask tmClient = new TimerTask() { @Override public void run() { DefaultListModel<String> modelClient = new DefaultListModel<String>(); for (int i = 0; i < mnClient.listClient.size(); i++) { modelClient.addElement(mnClient.listClient.get(i).username); } listClient.setModel(modelClient); } }; timerUpdateListClient.schedule(tmClient, 0, 2000); Timer timerUpdateList = new Timer(); TimerTask tt = new TimerTask() { @Override public void run() { DefaultListModel<String> model = new DefaultListModel<String>(); for (int i = 0; i < mf.listFile.size(); i++) { model.addElement(mf.listFile.get(i).fileName); } listF.setModel(model); } }; timerUpdateList.schedule(tt, 0, 2000); /*Timer timerUpdateFILE=new Timer(); TimerTask tFILE = new TimerTask() { @Override public void run() { File file = new File("file.txt"); file.delete(); BufferedWriter out; try { System.out.print("dang ghi file"); out = new BufferedWriter(new FileWriter(file, true)); for(int i = 0;i<mf.listFile.size();i++){ out.append("__FF__"+mf.listFile.get(i).fileName+"__FF__"+mf.listFile.get(i).path+"__FF__"+mf.listFile.get(i).size +"__FF__"+mf.listFile.get(i).userName+"__FF__"+mf.listFile.get(i).IP+"__FF__"+mf.listFile.get(i).port); out.newLine(); } out.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; timerUpdateFILE.schedule(tFILE, 0,2000);*/ frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { JOptionPane.showMessageDialog(frame, "Plase click exit buttom to close window"); } }); }
public JMovieControlAqua() { // Set the background color to the border color of the buttons. // This way the toolbar won't look too ugly when the buttons // are displayed before they have been loaded completely. // setBackground(new Color(118, 118, 118)); setBackground(Color.WHITE); Dimension buttonSize = new Dimension(16, 16); GridBagLayout gridbag = new GridBagLayout(); Insets margin = new Insets(0, 0, 0, 0); setLayout(gridbag); GridBagConstraints c; ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels"); colorCyclingButton = new JToggleButton(); colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText")); colorCyclingButton.addActionListener(this); colorCyclingButton.setPreferredSize(buttonSize); colorCyclingButton.setMinimumSize(buttonSize); colorCyclingButton.setVisible(false); colorCyclingButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(colorCyclingButton, c); add(colorCyclingButton); audioButton = new JToggleButton(); audioButton.setToolTipText(labels.getString("audio.toolTipText")); audioButton.addActionListener(this); audioButton.setPreferredSize(buttonSize); audioButton.setMinimumSize(buttonSize); audioButton.setVisible(false); audioButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(audioButton, c); add(audioButton); startButton = new JToggleButton(); startButton.setToolTipText(labels.getString("play.toolTipText")); startButton.addActionListener(this); startButton.setPreferredSize(buttonSize); startButton.setMinimumSize(buttonSize); startButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 1; // c.gridy = 0; gridbag.setConstraints(startButton, c); add(startButton); slider = new JMovieSliderAqua(); c = new GridBagConstraints(); // c.gridx = 2; // c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(slider, c); add(slider); rewindButton = new JButton(); rewindButton.setToolTipText(labels.getString("previous.toolTipText")); rewindButton.setPreferredSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 3; // c.gridy = 0; gridbag.setConstraints(rewindButton, c); add(rewindButton); rewindButton.addActionListener(this); forwardButton = new JButton(); forwardButton.setToolTipText(labels.getString("next.toolTipText")); buttonSize = new Dimension(17, 16); forwardButton.setPreferredSize(buttonSize); forwardButton.setMinimumSize(buttonSize); forwardButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 4; // c.gridy = 0; gridbag.setConstraints(forwardButton, c); add(forwardButton); forwardButton.addActionListener(this); // The spacer is used when the play controls are hidden spacer = new JPanel(new BorderLayout()); spacer.setVisible(false); spacer.setPreferredSize(new Dimension(16, 16)); spacer.setMinimumSize(new Dimension(16, 16)); spacer.setOpaque(false); c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(spacer, c); add(spacer); Border border = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.border.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderP.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)))); Border westBorder = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWest.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWestP.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)))); startButton.setBorder(westBorder); colorCyclingButton.setBorder(westBorder); audioButton.setBorder(westBorder); rewindButton.setBorder(westBorder); forwardButton.setBorder(border); startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton)); colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton)); forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton)); colorCyclingButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setDisabledIcon( new ImageIcon( Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png"))); audioButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png"))); audioButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png"))); audioButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png"))); startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png"))); startButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png"))); startButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png"))); rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png"))); rewindButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png"))); forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png"))); forwardButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png"))); // Automatic scrolling scrollHandler = new ScrollHandler(); scrollTimer = new Timer(60, scrollHandler); scrollTimer.setInitialDelay(300); // default InitialDelay? forwardButton.addMouseListener(scrollHandler); rewindButton.addMouseListener(scrollHandler); }
private JComponent buildTopPanel(boolean enablePipette) throws ParseException { final JPanel result = new JPanel(new BorderLayout()); final JPanel previewPanel = new JPanel(new BorderLayout()); if (enablePipette && myPicker != null) { final JButton pipette = new JButton(); pipette.setUI(new BasicButtonUI()); pipette.setRolloverEnabled(true); pipette.setIcon(AllIcons.Ide.Pipette); pipette.setBorder(IdeBorderFactory.createEmptyBorder()); pipette.setRolloverIcon(AllIcons.Ide.Pipette_rollover); pipette.setFocusable(false); pipette.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myPicker.setInitialColor(getColor()); myPicker.show(); } }); previewPanel.add(pipette, BorderLayout.WEST); } myPreviewComponent = new ColorPreviewComponent(); previewPanel.add(myPreviewComponent, BorderLayout.CENTER); result.add(previewPanel, BorderLayout.NORTH); final JPanel rgbPanel = new JPanel(); rgbPanel.setLayout(new BoxLayout(rgbPanel, BoxLayout.X_AXIS)); if (!UIUtil.isUnderAquaLookAndFeel()) { myR_after.setPreferredSize(new Dimension(14, -1)); myG_after.setPreferredSize(new Dimension(14, -1)); myB_after.setPreferredSize(new Dimension(14, -1)); } rgbPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); rgbPanel.add(myR); rgbPanel.add(myRed); if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myR_after); rgbPanel.add(Box.createHorizontalStrut(2)); rgbPanel.add(myG); rgbPanel.add(myGreen); if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myG_after); rgbPanel.add(Box.createHorizontalStrut(2)); rgbPanel.add(myB); rgbPanel.add(myBlue); if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myB_after); rgbPanel.add(Box.createHorizontalStrut(2)); rgbPanel.add(myFormat); result.add(rgbPanel, BorderLayout.WEST); final JPanel hexPanel = new JPanel(); hexPanel.setLayout(new BoxLayout(hexPanel, BoxLayout.X_AXIS)); hexPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); hexPanel.add(new JLabel("#")); hexPanel.add(myHex); result.add(hexPanel, BorderLayout.EAST); return result; }
private void initGUI() { try { TableLayout thisLayout = new TableLayout( new double[][] { { 15.0, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, 15.0 }, { 6.0, 35.0, 35.0, 35.0, 35.0, 7.0, TableLayout.FILL, TableLayout.FILL, 7.0, 37.0, 7.0 } }); thisLayout.setHGap(5); thisLayout.setVGap(5); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { jLabel1 = new JLabel(); this.add(jLabel1, "1, 3, r, f"); jLabel1.setText("CC"); jLabel1.setFont(new Font("sansserif", Font.PLAIN, 13)); } { jLabel2 = new JLabel(); this.add(jLabel2, "1, 4, r, f"); jLabel2.setText(Translator.getTranslation("Subject")); jLabel2.setFont(new Font("sansserif", Font.PLAIN, 13)); } { textPane = new JTextPane(); this.add(textPane, "1, 6, 6, 7"); // jTextArea1.setBorder(BorderFactory.createLineBorder(Color.black)); // pane.setText("<html><body><b>This is a test</b></body></html>"); textPane.setFont(new Font("sansserif", Font.PLAIN, 16)); } { scrollPane = new JScrollPane(textPane); this.add(scrollPane, "1, 6, 6, 7"); } { jButton1 = new JButton(); this.add(jButton1, "3, 9"); jButton1.setText(Translator.getTranslation("Send")); jButton1.setUI(new RoundedCornerButtonUI(true, false)); jButton1.setBackground(Variables.active); jButton1.setFont(new Font("sansserif", Font.PLAIN, 13)); jButton1.setIcon(new ImageIcon("icons/mailsend.png")); jButton1.addMouseListener(this); } { jButton2 = new JButton(); this.add(jButton2, "4, 9"); jButton2.setText(Translator.getTranslation("Cancel")); jButton2.setUI(new RoundedCornerButtonUI(true, false)); jButton2.setBackground(Variables.active); jButton2.setFont(new Font("sansserif", Font.PLAIN, 13)); jButton2.setIcon(new ImageIcon("icons/cancelmail.png")); jButton2.addMouseListener(this); } { jTextField1 = new JTextField(); this.add(jTextField1, "2, 3, 5, 3"); jTextField1.setFont(new Font("sansserif", Font.PLAIN, 16)); } { jTextField2 = new JTextField(); this.add(jTextField2, "2, 4, 5, 4"); jTextField2.setFont(new Font("sansserif", Font.PLAIN, 16)); } { jLabel3 = new JLabel(); this.add(jLabel3, "1, 2, r, f"); jLabel3.setText(Translator.getTranslation("To")); jLabel3.setFont(new Font("sansserif", Font.PLAIN, 13)); } { jTextField3 = new JTextField(); this.add(jTextField3, "2, 2, 5, 2"); jTextField3.setFont(new Font("sansserif", Font.PLAIN, 16)); } { jRadioButton1 = new JRadioButton(); this.add(jRadioButton1, "3,1,c,f"); jRadioButton1.setText(Translator.getTranslation("Send To All")); jRadioButton1.setBackground(Variables.back); jRadioButton1.setFont(new Font("sansserif", Font.PLAIN, 13)); jRadioButton1.addMouseListener(this); } { jRadioButton2 = new JRadioButton(); this.add(jRadioButton2, "4,1,c,f"); jRadioButton2.setText(Translator.getTranslation("Enter Recipient(s)")); jRadioButton2.setBackground(Variables.back); jRadioButton2.setFont(new Font("sansserif", Font.PLAIN, 13)); jRadioButton2.addMouseListener(this); } jRadioButton1.setSelected(true); jTextField3.setEditable(false); } catch (Exception e) { e.printStackTrace(); } }
public PanelGame() { Property prop = new Property(Paths.get(System.getProperty("user.dir"), "jundokan.ini").toString()); Locale.setDefault(new Locale(prop.getKey("locale"))); try { Path path = Paths.get(System.getProperty("user.dir"), "/lang/", Locale.getDefault().toString()); bundle = ResourceBundle.getBundle( "PanelGame", Locale.getDefault(), new URLClassLoader(new URL[] {path.toUri().toURL()})); } catch (MalformedURLException e1) { e1.printStackTrace(); } setLayout(new BorderLayout(0, 0)); JPanel panelButtons = new JPanel(); panelButtons.setBackground(SystemColor.control); add(panelButtons, BorderLayout.NORTH); panelButtons.setLayout(new GridLayout(0, 3, -1, 0)); cardsPanel = new JPanel(); add(cardsPanel, BorderLayout.CENTER); cardsPanel.setLayout(new CardLayout(0, 0)); stepOne = PanelStepOne.getInstance(); cardsPanel.add(stepOne, "stepOne"); btnStepOne = new JButton(bundle.getString("btnStepOne")); btnStepOne.setFocusPainted(false); btnStepOne.setUI(new MetalButtonUI()); btnStepOne.setBorder(BorderFactory.createLineBorder(Color.black)); btnStepOne.setBackground(new Color(10, 147, 252)); btnStepOne.setForeground(Color.WHITE); btnStepOne.setToolTipText(bundle.getString("tipStepOne")); btnStepOne.setFont(new Font("Trebuchet MS", Font.ITALIC, 14)); btnStepOne.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnStepOne.setBackground(new Color(10, 147, 252)); btnStepOne.setForeground(Color.WHITE); btnStepTwo.setBackground(Color.WHITE); btnStepTwo.setForeground(Color.BLACK); btnStepThree.setBackground(Color.WHITE); btnStepThree.setForeground(Color.BLACK); CardLayout cl = (CardLayout) (cardsPanel.getLayout()); cl.show(cardsPanel, "stepOne"); } }); panelButtons.add(btnStepOne); btnStepTwo = new JButton(bundle.getString("btnStepTwo")); btnStepTwo.setBackground(Color.WHITE); btnStepTwo.setForeground(Color.BLACK); btnStepTwo.setFocusPainted(false); btnStepTwo.setUI(new MetalButtonUI()); btnStepTwo.setBorder(BorderFactory.createLineBorder(Color.black)); btnStepTwo.setToolTipText(bundle.getString("tipStepTwo")); btnStepTwo.setFont(new Font("Trebuchet MS", Font.ITALIC, 14)); btnStepTwo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (cheking()) { btnStepTwo.setBackground(new Color(10, 147, 252)); btnStepTwo.setForeground(Color.WHITE); btnStepOne.setBackground(Color.WHITE); btnStepOne.setForeground(Color.BLACK); btnStepThree.setBackground(Color.WHITE); btnStepThree.setForeground(Color.BLACK); stepTwo = PanelStepTwo.getInstance(); cardsPanel.add(stepTwo, "stepTwo"); CardLayout cl = (CardLayout) (cardsPanel.getLayout()); cl.show(cardsPanel, "stepTwo"); stepTwo.setColumns(stepOne.get()); } } }); panelButtons.add(btnStepTwo); btnStepThree = new JButton(bundle.getString("btnStepThree")); btnStepThree.setBackground(Color.WHITE); btnStepThree.setForeground(Color.BLACK); btnStepThree.setFocusPainted(false); btnStepThree.setUI(new MetalButtonUI()); btnStepThree.setBorder(BorderFactory.createLineBorder(Color.black)); btnStepThree.setToolTipText(bundle.getString("tipStepThree")); btnStepThree.setFont(new Font("Trebuchet MS", Font.ITALIC, 14)); btnStepThree.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (cheking()) { btnStepThree.setBackground(new Color(10, 147, 252)); btnStepThree.setForeground(Color.WHITE); btnStepOne.setBackground(Color.WHITE); btnStepOne.setForeground(Color.BLACK); btnStepTwo.setBackground(Color.WHITE); btnStepTwo.setForeground(Color.BLACK); new Thread( new Runnable() { @Override public void run() { stepThree = PanelStepThree.getInstance(); cardsPanel.add(stepThree, "stepThree"); CardLayout cl = (CardLayout) (cardsPanel.getLayout()); cl.show(cardsPanel, "stepThree"); btnStepOne.setVisible(false); btnStepTwo.setVisible(false); btnStepThree.setVisible(false); } }) .start(); deletePanel(createGame()); } } }); panelButtons.add(btnStepThree); }