public void setUpProperties() throws Exception { // <Begin_setUpProperties> try { Top.setBackground(new Color(-1)); } catch (Exception ex) { showStatus(NmsClientUtil.GetString("Exception while setting properties for bean ") + Top, ex); } setResizable(false); try { JPanel1.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JPanel1, ex); } try { RouterBtn.setFocusPainted(false); RouterBtn.setIcon( NmsClientUtil.getImageIcon( applet.getDocumentBase() + "../images/router_new1.png")); // No Internationalisation RouterBtn.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + RouterBtn, ex); } try { eight.setOpaque(true); eight.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + eight, ex); } eight.setVisible(false); try { one.setOpaque(true); one.setToolTipText(""); // No Internationalisation one.setBackground(new Color(-1)); } catch (Exception ex) { showStatus(NmsClientUtil.GetString("Exception while setting properties for bean ") + one, ex); } one.setVisible(false); try { six.setBackground(new Color(-1)); } catch (Exception ex) { showStatus(NmsClientUtil.GetString("Exception while setting properties for bean ") + six, ex); } six.setVisible(false); try { three.setOpaque(true); three.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + three, ex); } three.setVisible(false); try { four.setOpaque(true); four.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + four, ex); } four.setVisible(false); try { seven.setOpaque(true); seven.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + seven, ex); } seven.setVisible(false); try { two.setBackground(new Color(-1)); } catch (Exception ex) { showStatus(NmsClientUtil.GetString("Exception while setting properties for bean ") + two, ex); } two.setVisible(false); try { ten.setBackground(new Color(-1)); } catch (Exception ex) { showStatus(NmsClientUtil.GetString("Exception while setting properties for bean ") + ten, ex); } ten.setVisible(false); try { five.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + five, ex); } five.setVisible(false); try { nine.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + nine, ex); } nine.setVisible(false); try { JPanel2.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JPanel2, ex); } try { JPanel3.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JPanel3, ex); } try { JLabel1.setBackground(new Color(-1)); JLabel1.setHorizontalTextPosition(0); JLabel1.setHorizontalAlignment(0); JLabel1.setText(NmsClientUtil.GetString("Router details")); JLabel1.setFont(new Font("Dialog", 1, 14)); // No Internationalisation } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JLabel1, ex); } try { JPanel4.setBackground(new Color(-1)); java.lang.String[] JPanel4cardAndClassNames_array = new java.lang.String[2]; JPanel4cardAndClassNames_array[0] = "router=com.adventnet.nms.examples.routermap.RouterDetails"; // No Internationalisation JPanel4cardAndClassNames_array[1] = "inter=com.adventnet.nms.examples.routermap.IFDetails"; // No Internationalisation JPanel4.setCardAndClassNames(JPanel4cardAndClassNames_array); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JPanel4, ex); } try { JPanel5.setBackground(new Color(-1)); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + JPanel5, ex); } try { RefreshBtn.setText(NmsClientUtil.GetString("Refresh")); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + RefreshBtn, ex); } try { CloseBtn.setText(NmsClientUtil.GetString("Close")); } catch (Exception ex) { showStatus( NmsClientUtil.GetString("Exception while setting properties for bean ") + CloseBtn, ex); } CloseBtn.setPreferredSize( new Dimension( CloseBtn.getPreferredSize().width + 12, CloseBtn.getPreferredSize().height + 0)); JPanel5.setPreferredSize( new Dimension( JPanel5.getPreferredSize().width + 229, JPanel5.getPreferredSize().height + 4)); JPanel4.setPreferredSize( new Dimension( JPanel4.getPreferredSize().width + 507, JPanel4.getPreferredSize().height + 293)); JLabel1.setPreferredSize( new Dimension( JLabel1.getPreferredSize().width + 132, JLabel1.getPreferredSize().height + 8)); JPanel3.setPreferredSize( new Dimension( JPanel3.getPreferredSize().width + 168, JPanel3.getPreferredSize().height + 6)); // <End_setUpProperties> }
public NumbrixGUI() throws ParseException { // Board gameBoard) throws ParseException{ // Board this.gameBoard = new Board(); // Container setTitle(TITLE); setSize(WIDTH, HEIGHT); setDefaultCloseOperation(EXIT_ON_CLOSE); // About Frame jFrameAbout = new javax.swing.JFrame(); jFrameAbout.setResizable(false); jFrameAbout.setPreferredSize(new Dimension(500, 300)); jTextAreaAbout = new javax.swing.JTextArea(); jTextAreaAbout.setBackground(new java.awt.Color(240, 240, 240)); jTextAreaAbout.setColumns(20); jTextAreaAbout.setRows(10); jTextAreaAbout.setText( "\t\tNumbrix Version 1\n\nClass Project for Artificial Intelligence course.\nUniversity of Florida\nCISE\n\n\n\n\nby Rainer Ledesma\nhttp://www.cise.ufl.edu/~rledesma/\n"); jTextAreaAbout.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N jTextAreaAbout.setEditable(false); jTextAreaAbout.setPreferredSize(new Dimension(500, 300)); javax.swing.GroupLayout jFrameAboutLayout = new javax.swing.GroupLayout(jFrameAbout.getContentPane()); jFrameAbout.getContentPane().setLayout(jFrameAboutLayout); jFrameAboutLayout.setHorizontalGroup( jFrameAboutLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameAboutLayout .createSequentialGroup() .addGap(11, 11, 11) .addComponent( jTextAreaAbout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jFrameAboutLayout.setVerticalGroup( jFrameAboutLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameAboutLayout .createSequentialGroup() .addGap(0, 16, Short.MAX_VALUE) .addComponent( jTextAreaAbout, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 17, Short.MAX_VALUE))); // // Instructions Frame jFrameInstructions = new javax.swing.JFrame(); jFrameInstructions.setResizable(false); jFrameInstructions.setPreferredSize(new Dimension(500, 300)); jTextAreaInstructions = new javax.swing.JTextArea(); jTextAreaInstructions.setBackground(new java.awt.Color(240, 240, 240)); jTextAreaInstructions.setColumns(20); jTextAreaInstructions.setRows(10); jTextAreaInstructions.setText( "\t\tNumbrix\n" + "The object of Numbrix is to fill the board with sequence of consecutive \n" + "numbers from 1 to the maximun cell count. The numbers must fillow a \n" + "horizontal or vertical path (no diagonals)\n"); jTextAreaInstructions.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N jTextAreaInstructions.setEditable(false); jTextAreaInstructions.setPreferredSize(new Dimension(500, 300)); javax.swing.GroupLayout jFrameInstructionsLayout = new javax.swing.GroupLayout(jFrameInstructions.getContentPane()); jFrameInstructions.getContentPane().setLayout(jFrameInstructionsLayout); jFrameInstructionsLayout.setHorizontalGroup( jFrameInstructionsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameInstructionsLayout .createSequentialGroup() .addGap(11, 11, 11) .addComponent( jTextAreaInstructions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jFrameInstructionsLayout.setVerticalGroup( jFrameInstructionsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameInstructionsLayout .createSequentialGroup() .addGap(0, 16, Short.MAX_VALUE) .addComponent( jTextAreaInstructions, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 17, Short.MAX_VALUE))); // // File Chooser jFrameFileChooser = new javax.swing.JFrame(); jFileChooser = new javax.swing.JFileChooser(); jFileChooser.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { jFileChooserActionPerformed(evt); } catch (Exception ex) { JOptionPane.showMessageDialog(frame, "File Exception"); } } }); javax.swing.GroupLayout jFrameFileChooserLayout = new javax.swing.GroupLayout(jFrameFileChooser.getContentPane()); jFrameFileChooser.getContentPane().setLayout(jFrameFileChooserLayout); jFrameFileChooserLayout.setHorizontalGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 618, Short.MAX_VALUE) .addGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameFileChooserLayout .createSequentialGroup() .addGap(18, 18, 18) .addComponent( jFileChooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18)))); jFrameFileChooserLayout.setVerticalGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 456, Short.MAX_VALUE) .addGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameFileChooserLayout .createSequentialGroup() .addGap(27, 27, 27) .addComponent( jFileChooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(32, 32, 32)))); // // SidePanel jPanelSideBar = new javax.swing.JPanel(); jButtonRESET = new javax.swing.JButton(); jButtonSOLVE = new javax.swing.JButton(); jButtonNEWGAME = new javax.swing.JButton(); jLabelTIMER = new javax.swing.JLabel(); jButtonPAUSE = new javax.swing.JButton(); jButtonRESET.setText("RESET"); jButtonRESET.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRESETActionPerformed(evt); } }); jButtonSOLVE.setText("SOLVE"); jButtonSOLVE.setEnabled(false); jButtonSOLVE.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { jButtonSOLVEActionPerformed(evt); } catch (IOException ex) { Logger.getLogger(NumbrixGUI.class.getName()).log(Level.SEVERE, null, ex); } } }); jButtonNEWGAME.setText("NEW GAME"); jButtonNEWGAME.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNEWGAMEActionPerformed(evt); } }); jLabelTIMER.setText("TIMER"); jLabelTIMER.setFont(new java.awt.Font("Agency FB", 1, 18)); jButtonPAUSE.setText("PAUSE"); jButtonPAUSE.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPAUSEActionPerformed(evt); } }); jLabelClock = new javax.swing.JLabel(); jLabelClock.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N jLabelClock.setText("10 : 99 : 60"); javax.swing.GroupLayout jPanelSideBarLayout = new javax.swing.GroupLayout(jPanelSideBar); jPanelSideBar.setLayout(jPanelSideBarLayout); jPanelSideBarLayout.setHorizontalGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanelSideBarLayout .createSequentialGroup() .addContainerGap() .addGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jButtonRESET, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jButtonSOLVE, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jButtonNEWGAME, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE) .addComponent( jButtonPAUSE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( jPanelSideBarLayout .createSequentialGroup() .addGroup( jPanelSideBarLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelTIMER) .addComponent( jLabelClock, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); jPanelSideBarLayout.setVerticalGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanelSideBarLayout .createSequentialGroup() .addContainerGap() .addComponent(jLabelTIMER) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jLabelClock, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonPAUSE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 229, Short.MAX_VALUE) .addComponent(jButtonNEWGAME) .addGap(18, 18, 18) .addComponent(jButtonRESET) .addGap(18, 18, 18) .addComponent(jButtonSOLVE) .addContainerGap())); //////// // Menu jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItemNewGame = new javax.swing.JMenuItem(); jMenuItemExit = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItemInstructions = new javax.swing.JMenuItem(); jMenuItemAbout = new javax.swing.JMenuItem(); jMenu1.setText("File"); jMenu2.setText("Edit"); jMenuItemNewGame.setText("New Game"); jMenuItemExit.setText("Exit"); jMenuItemInstructions.setText("Instructions"); jMenuItemAbout.setText("About Numbrix"); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu2); jMenu1.add(jMenuItemNewGame); jMenu1.add(jMenuItemExit); jMenu2.add(jMenuItemInstructions); jMenu2.add(jMenuItemAbout); setJMenuBar(jMenuBar1); jMenuItemNewGame.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemNewGameActionPerformed(evt); } }); jMenuItemExit.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemExitActionPerformed(evt); } }); jMenuItemInstructions.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemInstructionsActionPerformed(evt); } }); jMenuItemAbout.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemAboutActionPerformed(evt); } }); // // SolvedBoardPanel jPanelSolvedBoard = new javax.swing.JPanel(); jPanelSolvedBoard.setBackground(new java.awt.Color(255, 255, 255)); // Solved Board Frame jFrameSolvedBoard = new javax.swing.JFrame(); jFrameSolvedBoard.setTitle("Numbrix Solution"); javax.swing.GroupLayout jFrameSolvedBoardLayout = new javax.swing.GroupLayout(jFrameSolvedBoard.getContentPane()); jFrameSolvedBoard.getContentPane().setLayout(jFrameSolvedBoardLayout); jFrameSolvedBoardLayout.setHorizontalGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) .addGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanelSolvedBoard, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))); jFrameSolvedBoardLayout.setVerticalGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) .addGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanelSolvedBoard, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))); // BoardPanel boardPanel = new javax.swing.JPanel(); boardPanel.setBackground(new java.awt.Color(255, 255, 255)); // Clock gameTimer = new GameTimer(jLabelClock); this.gameTimer.start(); this.gameTimer.run(); // Initialize // init(); // Container Layout javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap() .addComponent( boardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent( jPanelSideBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( boardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanelSideBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); }