/** Displays Game Screen. */ private void displayGame() { // true board1Label.setVisible(true); board2Label.setVisible(true); StarshipBattleTextLabel.setVisible(true); enemyBoardText.setVisible(true); myBoardText.setVisible(true); returnToMain.setVisible(true); ship1.setVisible(true); ship2.setVisible(true); ship3.setVisible(true); ship4.setVisible(true); ship5.setVisible(true); gameErrors.setVisible(true); whatIsHit.setVisible(true); whatIsMiss.setVisible(true); // false getServerName.setVisible(false); getIpNumber.setVisible(false); getPlayerNames.setVisible(false); back.setVisible(false); InstructionsBigText.setVisible(false); InstructionsText.setVisible(false); Credits.setVisible(false); Difficulty.setVisible(false); Easy.setVisible(false); Medium.setVisible(false); Hard.setVisible(false); MediumInput.setVisible(false); Start.setVisible(false); Cancel.setVisible(false); }
/** * Creates new form AddNewActivityTypePanel * * @param parent * @param modal * @param g */ public AddNewFileTypePanel(java.awt.Frame parent, boolean modal, Global g) { super(parent, modal); initComponents(); global = g; addListeners(); AddType.setEnabled(false); Cancel.requestFocusInWindow(); setIconImage(Toolkit.getDefaultToolkit().createImage(global.headerLogo)); setLocationRelativeTo(global.root); setVisible(true); }
/** * Creates new form ActivityTypeMaintenancePanel * * @param parent * @param modal * @param g */ public ActivityTypeMaintenancePanel(java.awt.Frame parent, boolean modal, Global g) { super(parent, modal); initComponents(); global = g; addTypeComboBox(global); setColumnSize(); addListeners(); loadTable(); Cancel.requestFocusInWindow(); setIconImage(Toolkit.getDefaultToolkit().createImage(global.headerLogo)); this.setLocationRelativeTo(parent); this.setVisible(true); }
/** Displays Lobby Screen. */ private void displayLobby() { // true MediumInput.setVisible(true); Start.setVisible(true); Cancel.setVisible(true); getServerName.setVisible(true); getIpNumber.setVisible(true); getPlayerNames.setVisible(true); // false gameErrors.setVisible(false); serversError.setVisible(false); back.setVisible(false); Credits.setVisible(false); Servers.setVisible(false); BigInput2.setVisible(false); LongInput.setVisible(false); LongInput2.setVisible(false); Join.setVisible(false); Create2.setVisible(false); ip.setVisible(false); serverName.setVisible(false); }
/** Displays Server Screen. */ private void displayServers() { // true back.setVisible(true); Servers.setVisible(true); BigInput2.setVisible(true); LongInput.setVisible(true); LongInput2.setVisible(true); Join.setVisible(true); Create2.setVisible(true); ip.setVisible(true); serverName.setVisible(true); serversError.setVisible(true); // false getServerName.setVisible(false); getIpNumber.setVisible(false); getPlayerNames.setVisible(false); loginCreate.setVisible(false); Credits.setVisible(false); Login.setVisible(false); Login2.setVisible(false); SmallInput.setVisible(false); SmallInput2.setVisible(false); SmallInput3.setVisible(false); SmallInput4.setVisible(false); SmallInput5.setVisible(false); CreateNewAccount.setVisible(false); Create.setVisible(false); MediumInput.setVisible(false); Start.setVisible(false); Cancel.setVisible(false); username.setVisible(false); password.setVisible(false); newUsername.setVisible(false); newPassword.setVisible(false); verifyPassword.setVisible(false); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ private void initComponents() { // GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); TopPanel = new javax.swing.JPanel(); TopRightPanel = new javax.swing.JPanel(); OtherDateChooser = new com.toedter.calendar.JDateChooser(); TopLeftPanel = new javax.swing.JPanel(); InvoiceLB = new javax.swing.JLabel(); InvoiceTF = new javax.swing.JTextField(); BottomPanel = new javax.swing.JPanel(); Cancel = new javax.swing.JButton(); OK = new javax.swing.JButton(); DummyLeftLabel = new javax.swing.JLabel(); RightDummyLabel = new javax.swing.JLabel(); TaxPanel = new javax.swing.JPanel(); AmountLabel = new javax.swing.JLabel(); AmountTF = new javax.swing.JTextField(); DescriptionLabel = new javax.swing.JLabel(); DescriptionArea = new javax.swing.JTextArea(); IncomeTransactionLabel = new javax.swing.JLabel(); jMenu1.setText("Menu"); jMenuBar1.add(jMenu1); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Income Dialog"); TopPanel.setLayout(new java.awt.BorderLayout()); TopRightPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); OtherDateChooser.setPreferredSize(new java.awt.Dimension(151, 20)); TopRightPanel.add(OtherDateChooser); TopPanel.add(TopRightPanel, java.awt.BorderLayout.EAST); TopLeftPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); InvoiceLB.setText("Invoice : "); TopLeftPanel.add(InvoiceLB); InvoiceTF.setColumns(12); TopLeftPanel.add(InvoiceTF); TopPanel.add(TopLeftPanel, java.awt.BorderLayout.WEST); getContentPane().add(TopPanel, java.awt.BorderLayout.NORTH); BottomPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10)); Cancel.setText("Cancel"); Cancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelActionPerformed(evt); } }); BottomPanel.add(Cancel); OK.setText("OK"); OK.setPreferredSize(new java.awt.Dimension(75, 25)); OK.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { OKActionPerformed(evt); } }); BottomPanel.add(OK); getContentPane().add(BottomPanel, java.awt.BorderLayout.SOUTH); DummyLeftLabel.setText(" "); getContentPane().add(DummyLeftLabel, java.awt.BorderLayout.WEST); RightDummyLabel.setText(" "); getContentPane().add(RightDummyLabel, java.awt.BorderLayout.EAST); TaxPanel.setLayout(new java.awt.GridBagLayout()); AmountLabel.setText("Amount of Transactions :"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); TaxPanel.add(AmountLabel, gridBagConstraints); AmountTF.setColumns(24); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); TaxPanel.add(AmountTF, gridBagConstraints); DescriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); DescriptionLabel.setText("Description :"); DescriptionLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); TaxPanel.add(DescriptionLabel, gridBagConstraints); DescriptionArea.setColumns(24); DescriptionArea.setLineWrap(true); DescriptionArea.setRows(5); DescriptionArea.setWrapStyleWord(true); DescriptionArea.setBorder(new javax.swing.border.EtchedBorder()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; TaxPanel.add(DescriptionArea, gridBagConstraints); IncomeTransactionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); IncomeTransactionLabel.setText("Income Transaction"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); TaxPanel.add(IncomeTransactionLabel, gridBagConstraints); getContentPane().add(TaxPanel, java.awt.BorderLayout.CENTER); pack(); } // GEN-END:initComponents
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; BottomPanel = new javax.swing.JPanel(); Cancel = new javax.swing.JButton(); OK = new javax.swing.JButton(); DummyTopLabel = new javax.swing.JLabel(); LeftDummyLabel = new javax.swing.JLabel(); RightDummyLabel = new javax.swing.JLabel(); ItemTabbedPane = new javax.swing.JTabbedPane(); ItemPanel = new javax.swing.JPanel(); ItemCodeLabel = new javax.swing.JLabel(); itemCodeTF = new javax.swing.JTextField(); nameLabel = new javax.swing.JLabel(); nameTF = new javax.swing.JTextField(); buyingPriceLabel = new javax.swing.JLabel(); buyingPriceTF = new javax.swing.JTextField(); salePriceLabel = new javax.swing.JLabel(); salePriceTF = new javax.swing.JTextField(); commentLabel = new javax.swing.JLabel(); commentTA = new javax.swing.JTextArea(); Notes1 = new javax.swing.JLabel(); Notes2 = new javax.swing.JLabel(); categoryLabel = new javax.swing.JLabel(); categoryTF = new javax.swing.JTextField(); AdditionalPropertiesPanel = new javax.swing.JPanel(); DetailSizeCheckBox = new javax.swing.JCheckBox(); LengthLabel = new javax.swing.JLabel(); LengthTF = new javax.swing.JTextField(); WidthLabel = new javax.swing.JLabel(); WidthTF = new javax.swing.JTextField(); HeightLabel = new javax.swing.JLabel(); HeightTF = new javax.swing.JTextField(); VolumeCheckBox = new javax.swing.JCheckBox(); VolumeLabel = new javax.swing.JLabel(); VolumeTF = new javax.swing.JTextField(); PrimaryMeasurementLabel = new javax.swing.JLabel(); PrimaryTF = new javax.swing.JTextField(); MeasurementLabel = new javax.swing.JLabel(); MeasurementTF = new javax.swing.JTextField(); SecondaryMeasurementLabel = new javax.swing.JLabel(); SecondaryTF = new javax.swing.JTextField(); Notes3 = new javax.swing.JLabel(); Notes4 = new javax.swing.JLabel(); Secondary_Third_Measurement_Label = new javax.swing.JLabel(); Third_Measurement_Label = new javax.swing.JLabel(); SecondaryThirdMeasurementTF = new javax.swing.JTextField(); ThirdTF = new javax.swing.JTextField(); OtherPanel = new javax.swing.JPanel(); ProducerLB = new javax.swing.JLabel(); AvailableSeller = new javax.swing.JScrollPane(); AvSel = new javax.swing.JList(listModel); AddSeller = new javax.swing.JButton(); RemoveSeller = new javax.swing.JButton(); ListSeller = new javax.swing.JScrollPane(); LsSel = new javax.swing.JList(itemsellerModel); AvailableSellers = new javax.swing.JLabel(); ItemSellers = new javax.swing.JLabel(); ProducerCoB = new javax.swing.JComboBox(); QuantityPanel = new javax.swing.JPanel(); QuantityTablePanel = new javax.swing.JPanel(); QuantityScrollPane = new javax.swing.JScrollPane(); QuantityTB = new javax.swing.JTable(); PropertiesPanel = new javax.swing.JPanel(); WarehouseCB = new javax.swing.JComboBox(); QuantityLB = new javax.swing.JLabel(); QuantityButtonPanel = new javax.swing.JPanel(); QuantityAddButton = new javax.swing.JButton(); QuantityEditButton = new javax.swing.JButton(); QuantityDeleteButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Edit Item"); BottomPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10)); Cancel.setText("Cancel"); Cancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelActionPerformed(evt); } }); BottomPanel.add(Cancel); OK.setText("OK"); OK.setPreferredSize(new java.awt.Dimension(75, 25)); OK.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { OKActionPerformed(evt); } }); BottomPanel.add(OK); getContentPane().add(BottomPanel, java.awt.BorderLayout.SOUTH); DummyTopLabel.setText(" "); getContentPane().add(DummyTopLabel, java.awt.BorderLayout.NORTH); LeftDummyLabel.setText(" "); getContentPane().add(LeftDummyLabel, java.awt.BorderLayout.WEST); RightDummyLabel.setText(" "); getContentPane().add(RightDummyLabel, java.awt.BorderLayout.EAST); ItemPanel.setLayout(new java.awt.GridBagLayout()); ItemPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); ItemCodeLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); ItemCodeLabel.setText("* Item Code : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 10); ItemPanel.add(ItemCodeLabel, gridBagConstraints); itemCodeTF.setColumns(12); itemCodeTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0); ItemPanel.add(itemCodeTF, gridBagConstraints); nameLabel.setText("* Name : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); ItemPanel.add(nameLabel, gridBagConstraints); nameTF.setColumns(12); nameTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); ItemPanel.add(nameTF, gridBagConstraints); buyingPriceLabel.setText("* Buying Price : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 10); ItemPanel.add(buyingPriceLabel, gridBagConstraints); buyingPriceTF.setColumns(12); buyingPriceTF.setFont(new java.awt.Font("Dialog", 1, 12)); buyingPriceTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 0); ItemPanel.add(buyingPriceTF, gridBagConstraints); salePriceLabel.setText("* Sale Price : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 10); ItemPanel.add(salePriceLabel, gridBagConstraints); salePriceTF.setColumns(12); salePriceTF.setFont(new java.awt.Font("Dialog", 1, 12)); salePriceTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 0); ItemPanel.add(salePriceTF, gridBagConstraints); commentLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); commentLabel.setText("Comment : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); ItemPanel.add(commentLabel, gridBagConstraints); commentTA.setColumns(16); commentTA.setLineWrap(true); commentTA.setRows(6); commentTA.setTabSize(4); commentTA.setWrapStyleWord(true); commentTA.setBorder(javax.swing.BorderFactory.createEtchedBorder()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; ItemPanel.add(commentTA, gridBagConstraints); Notes1.setText("Fields marked with an asterisk * are required."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = 2; ItemPanel.add(Notes1, gridBagConstraints); Notes2.setText( "<html><center>Choose either Detail of Size checkbox <br>\nor Volume checkbox then fill all the text <br>\nfields of that checkbox!</center></html>"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.gridwidth = 2; ItemPanel.add(Notes2, gridBagConstraints); categoryLabel.setText("* Category : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); ItemPanel.add(categoryLabel, gridBagConstraints); categoryTF.setColumns(12); categoryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); ItemPanel.add(categoryTF, gridBagConstraints); ItemTabbedPane.addTab("Item", ItemPanel); AdditionalPropertiesPanel.setLayout(new java.awt.GridBagLayout()); DetailSizeCheckBox.setText("Detail of Size"); DetailSizeCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { DetailSizeCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; AdditionalPropertiesPanel.add(DetailSizeCheckBox, gridBagConstraints); LengthLabel.setText("Length : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(LengthLabel, gridBagConstraints); LengthTF.setColumns(12); LengthTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(LengthTF, gridBagConstraints); WidthLabel.setText("Width : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(WidthLabel, gridBagConstraints); WidthTF.setColumns(12); WidthTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(WidthTF, gridBagConstraints); HeightLabel.setText("Height : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(HeightLabel, gridBagConstraints); HeightTF.setColumns(12); HeightTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(HeightTF, gridBagConstraints); VolumeCheckBox.setText("Volume"); VolumeCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { VolumeCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; AdditionalPropertiesPanel.add(VolumeCheckBox, gridBagConstraints); VolumeLabel.setText("Volume : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(VolumeLabel, gridBagConstraints); VolumeTF.setColumns(12); VolumeTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(VolumeTF, gridBagConstraints); PrimaryMeasurementLabel.setText("* Primary Measurement : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(PrimaryMeasurementLabel, gridBagConstraints); PrimaryTF.setColumns(12); PrimaryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(PrimaryTF, gridBagConstraints); MeasurementLabel.setText("* P = S : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(MeasurementLabel, gridBagConstraints); MeasurementTF.setColumns(12); MeasurementTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(MeasurementTF, gridBagConstraints); SecondaryMeasurementLabel.setText("* Secondary Measurement : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(SecondaryMeasurementLabel, gridBagConstraints); SecondaryTF.setColumns(12); SecondaryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(SecondaryTF, gridBagConstraints); Notes3.setText( "<html><center>Choose either Detail of Size checkbox <br>\nor Volume checkbox then fill all the text <br>\nfields of that checkbox!</center></html>"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 12; gridBagConstraints.gridwidth = 2; AdditionalPropertiesPanel.add(Notes3, gridBagConstraints); Notes4.setText("Fields marked with an asterisk * are required."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 11; gridBagConstraints.gridwidth = 2; AdditionalPropertiesPanel.add(Notes4, gridBagConstraints); Secondary_Third_Measurement_Label.setText("S = T : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(Secondary_Third_Measurement_Label, gridBagConstraints); Third_Measurement_Label.setText("Third Measurement : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); AdditionalPropertiesPanel.add(Third_Measurement_Label, gridBagConstraints); SecondaryThirdMeasurementTF.setColumns(12); SecondaryThirdMeasurementTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 9; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(SecondaryThirdMeasurementTF, gridBagConstraints); ThirdTF.setColumns(12); ThirdTF.setHorizontalAlignment(javax.swing.JTextField.LEFT); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 10; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); AdditionalPropertiesPanel.add(ThirdTF, gridBagConstraints); ItemTabbedPane.addTab("Additional Properties", AdditionalPropertiesPanel); OtherPanel.setLayout(new java.awt.GridBagLayout()); ProducerLB.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); ProducerLB.setText("Producer : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; OtherPanel.add(ProducerLB, gridBagConstraints); AvailableSeller.setBorder(javax.swing.BorderFactory.createEtchedBorder()); AvailableSeller.setPreferredSize(new java.awt.Dimension(200, 100)); AvSel.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); AvSel.setVisibleRowCount(-1); AvailableSeller.setViewportView(AvSel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 20); OtherPanel.add(AvailableSeller, gridBagConstraints); AddSeller.setText(">"); AddSeller.setName("toRight"); AddSeller.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { MoveSellerActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); OtherPanel.add(AddSeller, gridBagConstraints); RemoveSeller.setText("<"); RemoveSeller.setName("toLeft"); RemoveSeller.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { MoveSellerActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; OtherPanel.add(RemoveSeller, gridBagConstraints); ListSeller.setBorder(javax.swing.BorderFactory.createEtchedBorder()); ListSeller.setPreferredSize(new java.awt.Dimension(200, 100)); LsSel.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); LsSel.setVisibleRowCount(-1); ListSeller.setViewportView(LsSel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 20); OtherPanel.add(ListSeller, gridBagConstraints); AvailableSellers.setText("Available Sellers : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); OtherPanel.add(AvailableSellers, gridBagConstraints); ItemSellers.setText("Item Sellers : "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); OtherPanel.add(ItemSellers, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; OtherPanel.add(ProducerCoB, gridBagConstraints); ItemTabbedPane.addTab("Producer & Seller", OtherPanel); QuantityTablePanel.setLayout(new java.awt.BorderLayout()); QuantityTB.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String[] {"Date", "Quantity"}) { Class[] types = new Class[] {java.lang.String.class, java.lang.Integer.class}; boolean[] canEdit = new boolean[] {false, false}; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); QuantityScrollPane.setViewportView(QuantityTB); QuantityTablePanel.add(QuantityScrollPane, java.awt.BorderLayout.CENTER); WarehouseCB.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); WarehouseCB.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WarehouseCBActionPerformed(evt); } }); PropertiesPanel.add(WarehouseCB); QuantityLB.setText("jLabel1"); PropertiesPanel.add(QuantityLB); QuantityTablePanel.add(PropertiesPanel, java.awt.BorderLayout.NORTH); QuantityAddButton.setText("Add"); QuantityAddButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { QuantityAddButtonActionPerformed(evt); } }); QuantityButtonPanel.add(QuantityAddButton); QuantityEditButton.setText("Edit"); QuantityEditButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { QuantityEditButtonActionPerformed(evt); } }); QuantityButtonPanel.add(QuantityEditButton); QuantityDeleteButton.setText("Delete"); QuantityDeleteButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { QuantityDeleteButtonActionPerformed(evt); } }); QuantityButtonPanel.add(QuantityDeleteButton); QuantityTablePanel.add(QuantityButtonPanel, java.awt.BorderLayout.SOUTH); QuantityPanel.add(QuantityTablePanel); ItemTabbedPane.addTab("Quantity", QuantityPanel); getContentPane().add(ItemTabbedPane, java.awt.BorderLayout.CENTER); pack(); } // </editor-fold>//GEN-END:initComponents
/** * If statements to see if any labels are hoovered over. If so, the image is changed. If left, the * image is changed. */ public void mouseMoved(MouseEvent e) { if (layeredPane.findComponentAt(e.getX(), e.getY()) != NewgameText) { NewgameText.setIcon(new ImageIcon("img/New game text.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == NewgameText) { NewgameText.setIcon(new ImageIcon("img/newgameholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != InstructionsSmallText) { InstructionsSmallText.setIcon(new ImageIcon("img/instructionstext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == InstructionsSmallText) { InstructionsSmallText.setIcon(new ImageIcon("img/Instructionsholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != HighscoreText) { HighscoreText.setIcon(new ImageIcon("img/highscoretext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == HighscoreText) { HighscoreText.setIcon(new ImageIcon("img/highscoreholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != ExitGameText) { ExitGameText.setIcon(new ImageIcon("img/exit game.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == ExitGameText) { ExitGameText.setIcon(new ImageIcon("img/exit game holdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != back) { back.setIcon(new ImageIcon("img/back.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == back) { back.setIcon(new ImageIcon("img/backholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != PlayerVsComp) { PlayerVsComp.setIcon(new ImageIcon("img/playvscomptext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == PlayerVsComp) { PlayerVsComp.setIcon(new ImageIcon("img/playvscompholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != PlayerVsPlayer) { PlayerVsPlayer.setIcon(new ImageIcon("img/playervsplayertext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == PlayerVsPlayer) { PlayerVsPlayer.setIcon(new ImageIcon("img/playervsplayertextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != TwoPlayerVsTwoPlayer) { TwoPlayerVsTwoPlayer.setIcon(new ImageIcon("img/2playervs2playertext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == TwoPlayerVsTwoPlayer) { TwoPlayerVsTwoPlayer.setIcon(new ImageIcon("img/2playervs2playertextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Easy) { Easy.setIcon(new ImageIcon("img/easytext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Easy) { Easy.setIcon(new ImageIcon("img/easytextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Medium) { Medium.setIcon(new ImageIcon("img/mediumtext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Medium) { Medium.setIcon(new ImageIcon("img/mediumtextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Hard) { Hard.setIcon(new ImageIcon("img/hardtext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Hard) { Hard.setIcon(new ImageIcon("img/hardtextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Online) { Online.setIcon(new ImageIcon("img/onlinetext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Online) { Online.setIcon(new ImageIcon("img/onlinetextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Lan) { Lan.setIcon(new ImageIcon("img/lantext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Lan) { Lan.setIcon(new ImageIcon("img/lantextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Login2) { Login2.setIcon(new ImageIcon("img/login.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Login2) { Login2.setIcon(new ImageIcon("img/loginholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Create) { Create.setIcon(new ImageIcon("img/create.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Create) { Create.setIcon(new ImageIcon("img/createholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Join) { Join.setIcon(new ImageIcon("img/join.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Join) { Join.setIcon(new ImageIcon("img/joinholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Create2) { Create2.setIcon(new ImageIcon("img/create.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Create2) { Create2.setIcon(new ImageIcon("img/createholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Start) { Start.setIcon(new ImageIcon("img/starttext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Start) { Start.setIcon(new ImageIcon("img/starttextholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Cancel) { Cancel.setIcon(new ImageIcon("img/cancel.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Cancel) { Cancel.setIcon(new ImageIcon("img/cancelholdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != returnToMain) { returnToMain.setIcon(new ImageIcon("img/return to main menu.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == returnToMain) { returnToMain.setIcon(new ImageIcon("img/return to main menu holdover.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != mainMenu) { mainMenu.setIcon(new ImageIcon("img/mainmenu.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == mainMenu) { mainMenu.setIcon(new ImageIcon("img/mainmenuholdover.png")); } displayCurrentScreen(); }
// If statements checking if any, and which label was clicked. Takes the // player another screen. public void mouseReleased(MouseEvent e) { if (layeredPane.findComponentAt(e.getX(), e.getY()) == NewgameText) { currentScreen = 2; if (dBg) System.out.println("New game screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != NewgameText) { NewgameText.setIcon(new ImageIcon("img/New game text.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == InstructionsSmallText) { currentScreen = 3; if (dBg) System.out.println("Instructions screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != InstructionsSmallText) { InstructionsSmallText.setIcon(new ImageIcon("img/instructionstext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == HighscoreText) { currentScreen = 4; if (dBg) System.out.println("Highscore screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != HighscoreText) { HighscoreText.setIcon(new ImageIcon("img/highscoretext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == ExitGameText) { currentScreen = 5; if (dBg) System.out.println("Game exits after 5seconds delay, and credit screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != ExitGameText) { ExitGameText.setIcon(new ImageIcon("img/exit game.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == PlayerVsComp) { currentScreen = 6; if (dBg) System.out.println("Difficulty screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != PlayerVsComp) { PlayerVsComp.setIcon(new ImageIcon("img/playvscomptext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == PlayerVsPlayer) { currentScreen = 7; if (dBg) System.out.println("Network Mode screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != PlayerVsPlayer) { PlayerVsPlayer.setIcon(new ImageIcon("img/playervsplayertext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == TwoPlayerVsTwoPlayer) { currentScreen = 7; if (dBg) System.out.println("Network Mode screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != TwoPlayerVsTwoPlayer) { TwoPlayerVsTwoPlayer.setIcon(new ImageIcon("img/2playervs2playertext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Easy) { if (dBg) System.out.println("game screen displayed"); currentScreen = 11; localGame = new LocalGame(this, 0); board1Label.setGame(localGame); board2Label.setGame(localGame); board1Label.setClickable(false); board2Label.setClickable(true); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Easy) { Easy.setIcon(new ImageIcon("img/easytext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Medium) { currentScreen = 11; localGame = new LocalGame(this, 1); board1Label.setGame(localGame); board2Label.setGame(localGame); board1Label.setClickable(false); board2Label.setClickable(true); if (dBg) System.out.println("game screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Medium) { Medium.setIcon(new ImageIcon("img/mediumtext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Hard) { localGame = new LocalGame(this, 2); board1Label.setGame(localGame); board2Label.setGame(localGame); board1Label.setClickable(false); board2Label.setClickable(true); currentScreen = 11; if (dBg) System.out.println("game screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Hard) { Hard.setIcon(new ImageIcon("img/hardtext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Online) { currentScreen = 8; // connect to the database loginCreate.setText("connecting..."); try { database = new Database("localhost", "battleship", "root", "rtpassword", ""); loginCreate.setText("Connected. Input your data."); } catch (Exception ex) { System.out.println("Unable to connect."); } if (dBg) System.out.println("Login screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Online) { Online.setIcon(new ImageIcon("img/onlinetext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Lan) { currentScreen = 8; if (dBg) System.out.println("Login screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Lan) { Lan.setIcon(new ImageIcon("img/lantext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Login2) { char[] passwordSequence = password.getPassword(); String userNameString = username.getText(); System.out.println("\n" + userNameString); for (int i = 0; i < passwordSequence.length; i++) System.out.print(passwordSequence[i]); String check = database.checkUser(username.getText(), new String(password.getPassword())); if (check == "OK") { currentScreen = 9; if (dBg) System.out.println("Server screen displayed"); } else { loginCreate.setText(check); } } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Login2) { Login2.setIcon(new ImageIcon("img/login.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Create) { char[] newPasswordSequence = newPassword.getPassword(); char[] verPassSequence = verifyPassword.getPassword(); String newUserNameString = newUsername.getText(); currentScreen = 9; if (dBg) System.out.println("Server screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Create) { Create.setIcon(new ImageIcon("img/create.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Join) { String ipString = ip.getText(); currentScreen = 10; if (dBg) System.out.println("Lobby screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Join) { Join.setIcon(new ImageIcon("img/join.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Create2) { String serverNameString = serverName.getText(); currentScreen = 10; if (dBg) System.out.println("Lobby screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Create2) { Create2.setIcon(new ImageIcon("img/create.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Start) { currentScreen = 11; if (dBg) System.out.println("Game screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Start) { Start.setIcon(new ImageIcon("img/starttext.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == Cancel) { currentScreen = 9; if (dBg) System.out.println("Server screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != Cancel) { Cancel.setIcon(new ImageIcon("img/cancel.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == returnToMain) { emptyArrays(); currentScreen = 1; if (dBg) System.out.println("start screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != returnToMain) { returnToMain.setIcon(new ImageIcon("img/return to main menu.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == mainMenu) { currentScreen = 1; if (dBg) System.out.println("start screen displayed"); } if (layeredPane.findComponentAt(e.getX(), e.getY()) != mainMenu) { mainMenu.setIcon(new ImageIcon("img/mainmenu.png")); } if (layeredPane.findComponentAt(e.getX(), e.getY()) == back) { switch (currentScreen) { case 2: currentScreen = 1; if (dBg) System.out.println("start screen displayed"); break; case 3: currentScreen = 1; if (dBg) System.out.println("start screen displayed"); break; case 4: currentScreen = 1; if (dBg) System.out.println("start screen displayed"); break; case 6: currentScreen = 2; if (dBg) System.out.println("New Game screen displayed"); break; case 7: currentScreen = 2; if (dBg) System.out.println("start screen displayed"); break; case 8: currentScreen = 7; if (dBg) System.out.println("Network mode screen displayed"); break; case 9: currentScreen = 8; if (dBg) System.out.println("Login screen displayed"); break; } } if (layeredPane.findComponentAt(e.getX(), e.getY()) != back) { back.setIcon(new ImageIcon("img/back.png")); } displayCurrentScreen(); }
@Test public void test() throws Exception { test.testCancel(); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); NewFileTypeTextBox = new javax.swing.JTextField(); AddType = new javax.swing.JButton(); Cancel = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); FileTypeAbbreviationTextBox = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Add New File Type"); setResizable(false); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("New File Type"); jLabel2.setText("File Name:"); AddType.setText("Add New Type"); AddType.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddTypeActionPerformed(evt); } }); Cancel.setText("Cancel"); Cancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelActionPerformed(evt); } }); jLabel3.setText("Abbreviation:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( NewFileTypeTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) .addComponent(FileTypeAbbreviationTextBox)) .addGap(0, 0, Short.MAX_VALUE)) .addComponent( AddType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( Cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( NewFileTypeTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent( FileTypeAbbreviationTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE) .addComponent(AddType) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Cancel) .addContainerGap())); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); Cancel = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); AddTypeButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Activity Type Maintenance Panel"); setResizable(false); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Activity Type Maintenance"); Cancel.setText("Cancel"); Cancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelActionPerformed(evt); } }); jTable1.setModel( new javax.swing.table.DefaultTableModel( new Object[][] {}, new String[] {"", "Activity", "Active"}) { Class[] types = new Class[] {java.lang.String.class, java.lang.String.class, java.lang.String.class}; boolean[] canEdit = new boolean[] {false, false, true}; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jTable1.setColumnSelectionAllowed(true); jTable1.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(jTable1); jTable1 .getColumnModel() .getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); if (jTable1.getColumnModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(0).setResizable(false); jTable1.getColumnModel().getColumn(1).setResizable(false); jTable1.getColumnModel().getColumn(2).setResizable(false); } AddTypeButton.setText("Add Type"); AddTypeButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddTypeButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE) .addComponent( jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE) .addComponent( AddTypeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( Cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addComponent(AddTypeButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Cancel) .addContainerGap())); pack(); } // </editor-fold>//GEN-END:initComponents