List of usage examples for javax.swing DefaultListModel DefaultListModel
DefaultListModel
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;//from w w w. j av a 2 s . c o m bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 5, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); // bPanel.add(new JPanel(),BorderLayout.NORTH); addButton1.addActionListener(this); addButton2.addActionListener(this); addButton3.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); removeButton3.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); lModelPullout = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); listPulloutRemoved = new JList(lModelPullout); paintTable(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); listPulloutRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools3 = new JToolBar(JToolBar.VERTICAL); if (mapDep) { tools1.add(depLabel); tools1.add(addButton1); tools1.add(removeButton1); } if (mapIndep) { tools2.add(indLabel); tools2.add(addButton2); tools2.add(removeButton2); } if (mapPullout) { tools3.add(pulloutLabel); tools3.add(addButton3); tools3.add(removeButton3); } tools1.setFloatable(false); tools2.setFloatable(false); tools3.setFloatable(false); /* topPanel.add(listAdded); topPanel.add(addButton); topPanel.add(listDepRemoved); bottomPanel.add(listIndepRemoved); bottomPanel.add(addButton2); bottomPanel.add(list4); */ JRadioButton legendPanelOnSwitch; JRadioButton legendPanelOffSwitch; // JPanel choicesPanel = new JPanel(); choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS)); legendPanelOnSwitch = new JRadioButton("On"); legendPanelOnSwitch.addActionListener(this); legendPanelOnSwitch.setActionCommand(LEGENDON); legendPanelOnSwitch.setSelected(false); legendPanelOn = false; legendPanelOffSwitch = new JRadioButton("Off"); legendPanelOffSwitch.addActionListener(this); legendPanelOffSwitch.setActionCommand(LEGENDOFF); legendPanelOffSwitch.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(legendPanelOnSwitch); group.add(legendPanelOffSwitch); choicesPanel.add(new JLabel("Turn the legend panel:")); choicesPanel.add(legendPanelOnSwitch); choicesPanel.add(legendPanelOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JRadioButton rotateOnSwitch; JRadioButton rotateOffSwitch; // JPanel rotateChoicesPanel = new JPanel(); rotateChoicesPanel.setLayout(new BoxLayout(rotateChoicesPanel, BoxLayout.Y_AXIS)); rotateOnSwitch = new JRadioButton("On"); rotateOnSwitch.addActionListener(this); rotateOnSwitch.setActionCommand(ROTATEON); rotateOnSwitch.setSelected(false); rotateOn = false; rotateOffSwitch = new JRadioButton("Off"); rotateOffSwitch.addActionListener(this); rotateOffSwitch.setActionCommand(ROTATEOFF); rotateOffSwitch.setSelected(true); ButtonGroup group2 = new ButtonGroup(); group2.add(rotateOnSwitch); group2.add(rotateOffSwitch); choicesPanel.add(new JLabel("Turn the rotator:")); choicesPanel.add(rotateOnSwitch); choicesPanel.add(rotateOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JPanel emptyPanel = new JPanel(); JPanel emptyPanel2 = new JPanel(); JPanel emptyPanel3 = new JPanel(); //2X5 //first line mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); mapPanel.add(tools3); if (mapPullout) mapPanel.add(new JScrollPane(listPulloutRemoved)); else mapPanel.add(emptyPanel); //second line-- mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); mapPanel.add(emptyPanel2); mapPanel.add(emptyPanel3); }
From source file:homenetapp.HomeNetAppGui.java
/** This method is called from within the constructor to * initialize the form./*from ww w. ja va2 s .c o m*/ * 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() { SendPacketFrame = new javax.swing.JFrame(); sendPacketButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); toNodeLabel = new javax.swing.JLabel(); toNodeSpinner = new javax.swing.JSpinner(); toDeviceLabel = new javax.swing.JLabel(); toDeviceSpinner = new javax.swing.JSpinner(); fromNodeLabel = new javax.swing.JLabel(); fromNodeSpinner = new javax.swing.JSpinner(); fromDeviceLabel = new javax.swing.JLabel(); commandLabel = new javax.swing.JLabel(); commandComboBox = new javax.swing.JComboBox(); payloadLabel = new javax.swing.JLabel(); payloadTextField = new javax.swing.JTextField(); fromDeviceSpinner = new javax.swing.JSpinner(); jSplitPane1 = new javax.swing.JSplitPane(); SettingsDialog = new javax.swing.JDialog(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel4 = new javax.swing.JPanel(); serverLabel = new javax.swing.JLabel(); apiKeyLabel = new javax.swing.JLabel(); serverTextField = new javax.swing.JTextField(); apiKeyTextField = new javax.swing.JTextField(); testButton = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); certPropertiesLabel = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); serverPortLabel = new javax.swing.JLabel(); serverPortTextField = new javax.swing.JTextField(); enableUPnPCheckBox = new javax.swing.JCheckBox(); enableServerCheckBox = new javax.swing.JCheckBox(); jSeparator1 = new javax.swing.JSeparator(); jPanel6 = new javax.swing.JPanel(); checkForUpdatesCheckBox = new javax.swing.JCheckBox(); settingsSaveButton = new javax.swing.JButton(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); cardPanel = new javax.swing.JPanel(); mainPanel = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jSplitPane2 = new javax.swing.JSplitPane(); jPanel2 = new javax.swing.JPanel(); jLabel9 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); packetTextArea = new javax.swing.JTextArea(); jScrollPane3 = new javax.swing.JScrollPane(); packetListModel = new DefaultListModel(); jList1 = new javax.swing.JList(); autoUpdateToggleButton = new javax.swing.JToggleButton(); jScrollPane1 = new javax.swing.JScrollPane(); consoleTextPane = new javax.swing.JTextPane(); statusPanel = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); localStatusLabel = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); remoteStatusLabel = new javax.swing.JLabel(); localSendingLabel = new javax.swing.JLabel(); localReceivingLabel = new javax.swing.JLabel(); remoteSendingLabel = new javax.swing.JLabel(); remoteReceivingLabel = new javax.swing.JLabel(); topMenuBar = new javax.swing.JMenuBar(); menuFile = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); menuTools = new javax.swing.JMenu(); menuToolsSendPacket = new javax.swing.JMenuItem(); menuToolsSettings = new javax.swing.JMenuItem(); menuSerialPorts = new javax.swing.JMenu(); menuHelp = new javax.swing.JMenu(); menuHelpOnline = new javax.swing.JMenuItem(); menuHelpAbout = new javax.swing.JMenuItem(); SendPacketFrame.setTitle("Send Packet"); SendPacketFrame.setMinimumSize(new java.awt.Dimension(380, 240)); SendPacketFrame.setResizable(false); SendPacketFrame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { SendPacketFrameWindowOpened(evt); } }); sendPacketButton.setText("Send"); sendPacketButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sendPacketButtonActionPerformed(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Packet")); toNodeLabel.setText("To Node: "); toNodeSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 4095, 1)); toDeviceLabel.setText("To Device:"); toDeviceSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 15, 1)); fromNodeLabel.setText("From Node:"); fromNodeSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 4095, 1)); fromDeviceLabel.setText("From Device:"); commandLabel.setText("Command:"); commandComboBox.setModel(new javax.swing.DefaultComboBoxModel(homenetapp.getCommandKeys())); commandComboBox.setRenderer(new CommandRenderer()); payloadLabel.setText("Payload:"); fromDeviceSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 15, 1)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(10, 10, 10).addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(payloadLabel) .addComponent(commandLabel).addComponent(fromNodeLabel).addComponent(toNodeLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(commandComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(toNodeSpinner).addComponent(fromNodeSpinner)) .addGap(18, 18, 18) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(fromDeviceLabel).addComponent(toDeviceLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(toDeviceSpinner, 0, 0, Short.MAX_VALUE).addComponent( fromDeviceSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 37, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, Short.MAX_VALUE)) .addComponent(payloadTextField)) .addContainerGap(17, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(toNodeLabel) .addComponent(toNodeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(toDeviceLabel).addComponent(toDeviceSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fromNodeLabel) .addComponent(fromNodeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fromDeviceLabel).addComponent(fromDeviceSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(commandComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(commandLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(payloadTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(payloadLabel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout SendPacketFrameLayout = new javax.swing.GroupLayout( SendPacketFrame.getContentPane()); SendPacketFrame.getContentPane().setLayout(SendPacketFrameLayout); SendPacketFrameLayout.setHorizontalGroup( SendPacketFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(SendPacketFrameLayout.createSequentialGroup().addContainerGap() .addGroup(SendPacketFrameLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(sendPacketButton).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); SendPacketFrameLayout.setVerticalGroup(SendPacketFrameLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(SendPacketFrameLayout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(sendPacketButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); SettingsDialog.setTitle("HomeNet Settings"); SettingsDialog.setMinimumSize(new java.awt.Dimension(400, 300)); SettingsDialog.setResizable(false); SettingsDialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { SettingsDialogWindowOpened(evt); } }); serverLabel.setText("Server:"); apiKeyLabel.setText("API Key:"); serverTextField.setEditable(false); serverTextField.setText("homenet.me"); apiKeyTextField.setText("reallylongstringofchars"); testButton.setText("Test"); testButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testButtonActionPerformed(evt); } }); jLabel1.setText("SSL Cert:"); certPropertiesLabel.setText("Loading..."); jButton1.setText("Paste"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(apiKeyLabel).addComponent(serverLabel)) .addComponent(jLabel1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addComponent(certPropertiesLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(testButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1)) .addComponent(apiKeyTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE) .addComponent(serverTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)) .addContainerGap())); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(serverTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(serverLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(apiKeyTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(apiKeyLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1).addComponent(certPropertiesLabel).addComponent(testButton) .addComponent(jButton1)) .addContainerGap(81, Short.MAX_VALUE))); jTabbedPane1.addTab("Client", jPanel4); serverPortLabel.setText("Port:"); serverPortTextField.setEditable(false); serverPortTextField.setText("2443"); enableUPnPCheckBox.setText("Enable UPnP Portforwarding"); enableServerCheckBox.setSelected(true); enableServerCheckBox.setText("Enable Local Server"); enableServerCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { enableServerCheckBoxActionPerformed(evt); } }); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(serverPortLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(serverPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(294, Short.MAX_VALUE)) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(enableServerCheckBox) .addContainerGap(250, Short.MAX_VALUE)) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(enableUPnPCheckBox) .addContainerGap(208, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(enableServerCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(serverPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(serverPortLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(enableUPnPCheckBox).addContainerGap(77, Short.MAX_VALUE))); jTabbedPane1.addTab("Server", jPanel5); checkForUpdatesCheckBox.setText("Check For Updates"); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout .setHorizontalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addComponent(checkForUpdatesCheckBox).addContainerGap(252, Short.MAX_VALUE))); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addComponent(checkForUpdatesCheckBox).addContainerGap(137, Short.MAX_VALUE))); jTabbedPane1.addTab("Preferences", jPanel6); settingsSaveButton.setText("Save"); settingsSaveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { settingsSaveButtonActionPerformed(evt); } }); javax.swing.GroupLayout SettingsDialogLayout = new javax.swing.GroupLayout(SettingsDialog.getContentPane()); SettingsDialog.getContentPane().setLayout(SettingsDialogLayout); SettingsDialogLayout.setHorizontalGroup(SettingsDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(SettingsDialogLayout.createSequentialGroup().addContainerGap().addGroup( SettingsDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(settingsSaveButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)) .addContainerGap())); SettingsDialogLayout.setVerticalGroup(SettingsDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SettingsDialogLayout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(settingsSaveButton).addContainerGap())); jTabbedPane1.getAccessibleContext().setAccessibleName("Server"); SettingsDialog.getAccessibleContext().setAccessibleName("HomeNet App Settings"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("HomeNet.me Desktop App"); cardPanel.setLayout(new java.awt.CardLayout()); mainPanel.setLayout(new javax.swing.BoxLayout(mainPanel, javax.swing.BoxLayout.Y_AXIS)); jSplitPane2.setDividerLocation(200); jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); jLabel9.setText("Packets Received:"); packetTextArea.setColumns(20); packetTextArea.setFont(new java.awt.Font("Courier New", 0, 12)); packetTextArea.setRows(5); jScrollPane2.setViewportView(packetTextArea); jList1.setModel(packetListModel); jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jList1.setCellRenderer(new PacketListRenderer()); jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jList1ValueChanged(evt); } }); jScrollPane3.setViewportView(jList1); autoUpdateToggleButton.setSelected(true); autoUpdateToggleButton.setText("Auto Update"); autoUpdateToggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { autoUpdateToggleButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9).addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(autoUpdateToggleButton).addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9).addComponent(autoUpdateToggleButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)) .addContainerGap())); jSplitPane2.setTopComponent(jPanel2); consoleTextPane.setBackground(new java.awt.Color(0, 0, 0)); consoleTextPane.setEditable(false); consoleTextPane.setFont(new java.awt.Font("Consolas", 0, 10)); consoleTextPane.setForeground(new java.awt.Color(255, 255, 255)); jScrollPane1.setViewportView(consoleTextPane); jSplitPane2.setRightComponent(jScrollPane1); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 530, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 320, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE))); mainPanel.add(jPanel3); statusPanel.setBackground(new java.awt.Color(204, 204, 204)); statusPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jLabel7.setText("Local:"); localStatusLabel.setText("Not Connected"); jLabel11.setText("Remote:"); remoteStatusLabel.setText("Not Connected"); localSendingLabel.setFont(new java.awt.Font("Courier New", 0, 11)); localSendingLabel.setText("( )"); localReceivingLabel.setFont(new java.awt.Font("Courier New", 0, 11)); localReceivingLabel.setText("( )"); remoteSendingLabel.setFont(new java.awt.Font("Courier New", 0, 11)); remoteSendingLabel.setText("( )"); remoteReceivingLabel.setFont(new java.awt.Font("Courier New", 0, 11)); remoteReceivingLabel.setText("( )"); javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel); statusPanel.setLayout(statusPanelLayout); statusPanelLayout.setHorizontalGroup(statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(statusPanelLayout.createSequentialGroup().addContainerGap().addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(localStatusLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(localSendingLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(localReceivingLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 177, Short.MAX_VALUE) .addComponent(jLabel11).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(remoteStatusLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(remoteSendingLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(remoteReceivingLabel).addContainerGap())); statusPanelLayout .setVerticalGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(localStatusLabel).addComponent(localSendingLabel) .addComponent(localReceivingLabel).addComponent(remoteSendingLabel) .addComponent(remoteReceivingLabel).addComponent(remoteStatusLabel) .addComponent(jLabel11))); mainPanel.add(statusPanel); cardPanel.add(mainPanel, "card2"); topMenuBar.setVisible(false); menuFile.setMnemonic('f'); menuFile.setText("File"); jMenuItem3.setMnemonic('e'); jMenuItem3.setText("Exit"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); menuFile.add(jMenuItem3); topMenuBar.add(menuFile); menuTools.setMnemonic('t'); menuTools.setText("Tools"); menuToolsSendPacket.setMnemonic('p'); menuToolsSendPacket.setText("Send Packet"); menuToolsSendPacket.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuToolsSendPacketActionPerformed(evt); } }); menuTools.add(menuToolsSendPacket); menuToolsSettings.setMnemonic('s'); menuToolsSettings.setText("Settings"); menuToolsSettings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuToolsSettingsActionPerformed(evt); } }); menuTools.add(menuToolsSettings); menuSerialPorts.setMnemonic('e'); menuSerialPorts.setText("Select Ports"); menuSerialPorts.addMenuListener(new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { } public void menuSelected(javax.swing.event.MenuEvent evt) { menuSerialPortsMenuSelected(evt); } }); menuSerialPorts.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuSerialPortsActionPerformed(evt); } }); menuTools.add(menuSerialPorts); topMenuBar.add(menuTools); menuHelp.setMnemonic('h'); menuHelp.setText("Help"); menuHelpOnline.setText("Online Help"); menuHelpOnline.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuHelpOnlineActionPerformed(evt); } }); menuHelp.add(menuHelpOnline); menuHelpAbout.setText("About"); menuHelpAbout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuHelpAboutActionPerformed(evt); } }); menuHelp.add(menuHelpAbout); topMenuBar.add(menuHelp); setJMenuBar(topMenuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)); pack(); }
From source file:net.sf.maltcms.chromaui.project.spi.wizard.DBProjectVisualPanel1.java
private DefaultListModel getListModel() { if (dlm == null) { dlm = new DefaultListModel(); } return dlm; }
From source file:com.atlassian.theplugin.idea.jira.IssueCreateDialog.java
private void addFixForVersions(List<JIRAFixForVersionBean> versions) { fixVersionsList.removeAll();/*from w w w . jav a2 s . c o m*/ final DefaultListModel listModel = new DefaultListModel(); for (JIRAFixForVersionBean version : versions) { if (version != null && version.getId() != CacheConstants.ANY_ID) { listModel.addElement(new VersionWrapper(version)); } } fixVersionsList.setModel(listModel); fixVersionsList.setEnabled(true); getOKAction().setEnabled(true); }
From source file:gtu._work.ui.RegexCatchReplacer.java
void reloadTemplateList() { DefaultListModel templateListModel = new DefaultListModel(); for (Entry<Object, Object> entry : prop.entrySet()) { templateListModel.addElement(entry); }/*from www .j a va 2 s . c o m*/ templateList.setModel(templateListModel); }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;// w w w . j a v a 2 s.c o m bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 3, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); addButton1.addActionListener(this); addButton2.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); paintMappingLists(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools1.add(depLabel); // tools2.add(indLabel); tools1.setFloatable(false); tools2.setFloatable(false); tools1.add(addButton1); tools1.add(removeButton1); // tools2.add(addButton2); // tools2.add(removeButton2); JRadioButton disChoices_normal; JRadioButton disChoices_poisson; // JPanel choicesPanel = new JPanel(); disChoices_normal = new JRadioButton("Normal"); disChoices_normal.addActionListener(this); disChoices_normal.setActionCommand(NORMAL); disChoices_normal.setSelected(true); disChoice = NORMAL; disChoices_poisson = new JRadioButton("Poisson"); disChoices_poisson.addActionListener(this); disChoices_poisson.setActionCommand(POISSON); ButtonGroup group = new ButtonGroup(); group.add(disChoices_normal); group.add(disChoices_poisson); choicesPanel.add(new JLabel("Choices of distribution:")); choicesPanel.add(disChoices_normal); choicesPanel.add(disChoices_poisson); choicesPanel.setPreferredSize(new Dimension(200, 100)); mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); // JPanel emptyPanel = new JPanel(new GridLayout(0,1)); // mapPanel.add(emptyPanel); mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); }
From source file:gtu.log.finder.ExceptionLogFinderUI.java
private void searchTextBtnAction() { File parseFile = getParseFile(); if (outputLogFile == null || !outputLogFile.exists()) { if (parseFile != null) { outputLogFile = parseFile;//w ww.j av a 2 s .c o m } else { JCommonUtil._jOptionPane_showMessageDialog_error("??"); return; } } String searchTxt = searchText.getText(); System.out.println("findText ==> " + searchTxt); try { Pattern startPtn = Pattern.compile("?(\\d+)[]+"); Pattern searchTextPtn = Pattern.compile(searchTxt, Pattern.CASE_INSENSITIVE); if (!ignoreCaseCheckBox.isSelected()) { searchTextPtn = Pattern.compile(searchTxt); } List<ExceptionSection> exceptionSecList = new ArrayList<ExceptionSection>(); String tempSecStr = null; Matcher matcher = null; List<String> markLineSectionNumberList = new ArrayList<String>(); BufferedReader reader = new BufferedReader( new InputStreamReader(new FileInputStream(outputLogFile), "utf8")); for (String line = null; (line = reader.readLine()) != null;) { matcher = startPtn.matcher(line); if (matcher.find()) { tempSecStr = matcher.group(1); } if (tempSecStr == null) { continue; } String tmpLine = line.replaceFirst("[\\d]+\\:", ""); tmpLine = tmpLine.replaceFirst("\\([\\d]+\\)\\:", ""); if (tmpLine.contains(searchTxt) || searchTextPtn.matcher(tmpLine).find()) { System.out.println("\ttempSecStr => " + tempSecStr); System.out.println("\ttmpLine => " + tmpLine); if (!markLineSectionNumberList.contains(tempSecStr)) { ExceptionSection es = new ExceptionSection(); es.line = line; es.sectionNumber = Integer.parseInt(tempSecStr); exceptionSecList.add(es); System.out.println(es); markLineSectionNumberList.add(tempSecStr); tempSecStr = null; } } else { System.out.println(":" + tmpLine); } } reader.close(); DefaultListModel searchMatchListModel = new DefaultListModel(); for (int ii = 0; ii < exceptionSecList.size(); ii++) { ExceptionSection es = exceptionSecList.get(ii); searchMatchListModel.addElement(es); } searchMatchList.setModel(searchMatchListModel); if (exceptionSecList.isEmpty()) { JCommonUtil._jOptionPane_showMessageDialog_info("??!"); } } catch (Exception ex) { JCommonUtil.handleException(ex); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchReTimerFrame.java
private void startCalculation() { jideRetimeTabbedPane.setSelectedIndex(0); if (parsedAttack == null || parsedAttack.getSource() == null || parsedAttack.getTarget() == null || parsedAttack.getUnit() == null || parsedAttack.getArriveTime() == null) { JOptionPaneHelper.showInformationBox(this, "Bitte fge zuerst einen gltigen Angriff ein und whle eine Einheit", "Information"); return;/* w ww . j av a 2 s . co m*/ } jCalculationSettingsDialog.pack(); jCalculationSettingsDialog.setLocationRelativeTo(DSWorkbenchReTimerFrame.this); DefaultListModel tagModel = new DefaultListModel(); tagModel.addElement(NoTag.getSingleton()); for (ManageableType e : TagManager.getSingleton().getAllElements()) { tagModel.addElement((Tag) e); } jTagList.setModel(tagModel); jRelationBox.setSelected(true); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); } jUnitBox.setModel(model); jUnitBox.setRenderer(new UnitListCellRenderer()); // <editor-fold defaultstate="collapsed" desc="Build attack plan table"> DefaultTableModel attackPlanTableModel = new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Angriffsplan", "Abgleichen" }) { Class[] types = new Class[] { String.class, Boolean.class }; @Override public Class getColumnClass(int columnIndex) { return types[columnIndex]; } @Override public boolean isCellEditable(int row, int col) { if (col == 0) { return false; } return true; } }; String[] plans = AttackManager.getSingleton().getGroups(); for (String plan : plans) { attackPlanTableModel.addRow(new Object[] { plan, false }); } jAttackPlanTable.setModel(attackPlanTableModel); DefaultTableCellRenderer headerRenderer = new SortableTableHeaderRenderer(); for (int i = 0; i < jAttackPlanTable.getColumnCount(); i++) { jAttackPlanTable.getColumn(jAttackPlanTable.getColumnName(i)).setHeaderRenderer(headerRenderer); } // </editor-fold> jCalculationSettingsDialog.setVisible(true); }
From source file:QuestionGUI.java
public void loadQuestion(Question q) { DefaultListModel<String> dlm = new DefaultListModel<>(); for (String choices : q.getChoices()) { dlm.addElement(choices);//ww w .j a va 2s . co m } questionSelect.setModel(dlm); questionText.setText(q.getQuestion()); questionSelect.setSelectedIndex(0); }
From source file:com.atlassian.theplugin.idea.jira.IssueCreateDialog.java
private void addComponents(Collection<JIRAComponentBean> components) { final DefaultListModel listModel = new DefaultListModel(); for (JIRAComponentBean constant : components) { if (constant != null && constant.getId() != CacheConstants.ANY_ID && constant.getId() != CacheConstants.UNKNOWN_COMPONENT_ID) { listModel.addElement(new ComponentWrapper(constant)); }/* www. j a va2s. co m*/ } componentsList.setModel(listModel); if (projectComboBox.getSelectedItem() != null && jiraConfiguration != null && jiraConfiguration.getView() != null && jiraConfiguration.getView().getServerDefaultss() != null && jiraConfiguration.getView().getServerDefaultss().containsKey(jiraServerData.getServerId())) { String selectedProject = ((JIRAProject) projectComboBox.getSelectedItem()).getKey(); String configProject = jiraConfiguration.getView().getServerDefaultss() .get(jiraServerData.getServerId()).getProject(); Collection<Long> configComponents = jiraConfiguration.getView().getServerDefaultss() .get(jiraServerData.getServerId()).getComponents(); // select default components for specified project if (selectedProject.equals(configProject)) { ArrayList<Integer> indexesToSelect = new ArrayList<Integer>( componentsList.getModel().getSize() + 1); for (int i = 0; i < componentsList.getModel().getSize(); ++i) { if (componentsList.getModel().getElementAt(i) instanceof ComponentWrapper) { ComponentWrapper wrapper = (ComponentWrapper) componentsList.getModel().getElementAt(i); if (wrapper.getWrapped() != null) { JIRAComponentBean component = wrapper.getWrapped(); if (configComponents.contains(component.getId())) { indexesToSelect.add(i); } } } } if (indexesToSelect.size() > 0) { componentsList.setSelectedIndices( ArrayUtils.toPrimitive(indexesToSelect.toArray(new Integer[indexesToSelect.size()]))); } } } componentsList.setEnabled(true); getOKAction().setEnabled(true); }