List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
From source file:at.becast.youploader.gui.FrmMain.java
public void initPlaylistSettingsTab() { JPanel TabPlaylistSettings = new JPanel(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.PlaylistSettings"), null, TabPlaylistSettings, null); JPanel panel_1 = new JPanel(); JScrollPane scrollPane = new JScrollPane(); GroupLayout gl_TabPlaylistSettings = new GroupLayout(TabPlaylistSettings); gl_TabPlaylistSettings.setHorizontalGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.LEADING) .addGroup(gl_TabPlaylistSettings.createSequentialGroup() .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE).addGap(8) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE) .addContainerGap())); gl_TabPlaylistSettings.setVerticalGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.TRAILING) .addGroup(gl_TabPlaylistSettings.createSequentialGroup() .addGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.LEADING) .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE) .addGroup(gl_TabPlaylistSettings.createSequentialGroup().addGap(11) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE))) .addContainerGap())); PlayPanel = new JPanel(); scrollPane.setViewportView(PlayPanel); PlayPanel.setLayout(new GridLayout(0, 2, 0, 0)); AccList = new JList<AccountType>(AccListModel); AccList.setOpaque(false);/*from ww w . j av a 2s .co m*/ AccList.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); AccList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); GroupLayout gl_panel_1 = new GroupLayout(panel_1); gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_1.createSequentialGroup().addContainerGap() .addComponent(AccList, GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE).addContainerGap())); gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_1.createSequentialGroup().addContainerGap() .addComponent(AccList, GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE).addContainerGap())); panel_1.setLayout(gl_panel_1); TabPlaylistSettings.setLayout(gl_TabPlaylistSettings); AccList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { selectPlaylistAccount(); } }); }
From source file:convcao.com.agent.ConvcaoNeptusInteraction.java
@Override public void initSubPanel() { jPanelMain = new JPanel(); jPanel1 = new JPanel(); jPanel2 = new JPanel(); jLabel2 = new JLabel(); jScrollPane1 = new JScrollPane(); jTextPane1 = new JTextPane(); renewButton = new JButton(); jLabel4 = new JLabel(); jTextField1 = new JTextField(); jLabel5 = new JLabel(); jPasswordField1 = new JPasswordField(); connectButton = new JButton(); jScrollPane2 = new JScrollPane(); jTextArea1 = new JTextArea(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); jButton1 = new JButton(); jButton2 = new JButton(); jLabel1 = new JLabel(); jLabel9 = new JLabel(); jLabel10 = new JLabel(); jLabel11 = new JLabel(); jLabel12 = new JLabel(); jLabel6 = new JLabel(); jLabel3 = new JLabel(); jLabel11.setIcon(noptilusLogo);/*w w w.j a v a 2s . co m*/ jLabel12.setHorizontalAlignment(SwingConstants.LEFT); jLabel12.setText("<html>www.convcao.com<br>version 0.01</html>"); jLabel12.setToolTipText(""); jLabel12.setHorizontalTextPosition(SwingConstants.RIGHT); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel11, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGap(0, 19, Short.MAX_VALUE).addComponent(jLabel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel11, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); jLabel2.setFont(new Font("Tahoma", 0, 10)); // NOI18N jLabel2.setText("Unique ID"); jTextPane1.setEditable(true); jScrollPane1.setViewportView(jTextPane1); //jTextPane1.getAccessibleContext().setAccessibleName(""); renewButton.setText("RENEW"); renewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { renewButtonActionPerformed(evt); } }); jLabel4.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel4.setText("Username"); jTextField1.setText("FTPUser"); jLabel5.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel5.setText("Password"); jPasswordField1.setText("FTPUser123"); connectButton.setText("Connect"); connectButton.setEnabled(false); connectButton.setActionCommand("connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { connectButtonActionPerformed(evt); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace(); } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); jTextArea1.setEditable(false); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); jLabel7.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel7.setText("Command Monitor"); jButton1.setFont(new Font("Tahoma", 1, 12)); // NOI18N jButton1.setText("START"); jButton1.setEnabled(false); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startButtonActionPerformed(evt); } }); jButton2.setFont(new Font("Tahoma", 1, 12)); // NOI18N jButton2.setText("STOP"); jButton2.setEnabled(false); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stopButtonActionPerformed(evt); } }); jLabel1.setForeground(new Color(255, 0, 0)); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText( "<html>Click HERE to activate the web service using your ID<br>When the web application is ready, press Start </html>"); jLabel1.setCursor(new Cursor(Cursor.HAND_CURSOR)); jLabel1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { try { jLabel1MouseClicked(evt); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } } }); //jLabel9.setText("Working..."); jLabel9.setIcon(runIcon); jLabel9.setVisible(false); jLabel10.setText("---"); jLabel6.setForeground(new Color(0, 204, 0)); jLabel6.setHorizontalAlignment(SwingConstants.CENTER); jLabel6.setText("---"); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(126, 126, 126) .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup().addGap(23, 23, 23) .addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jLabel9, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29) .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane2, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 308, GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel10, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 299, GroupLayout.PREFERRED_SIZE)))) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(renewButton)) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jPasswordField1))) .addGap(14, 14, 14).addComponent(connectButton))))) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(renewButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1) .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPasswordField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(connectButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel10, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE) .addGap(5, 5, 5))); jLabel1.getAccessibleContext().setAccessibleName("jLabel1"); jLabel3.setFont(new Font("Tahoma", 1, 22)); // NOI18N jLabel3.setText("Real Time Navigation"); jLabel8.setIcon(appLogo); GroupLayout layout = new GroupLayout(jPanelMain); jPanelMain.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 331, GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addComponent(jLabel3) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); addMenuItem("Settings>Noptilus>Coordinate Settings", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginUtils.editPluginProperties(coords, true); coords.saveProps(); } }); addMenuItem("Settings>Noptilus>ConvCAO Settings", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginUtils.editPluginProperties(ConvcaoNeptusInteraction.this, true); } }); addMenuItem("Settings>Noptilus>Force vehicle depth", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (positions.isEmpty()) { GuiUtils.errorMessage(getConsole(), "Force vehicle depth", "ConvCAO control is not active"); return; } String[] choices = nameTable.values().toArray(new String[0]); String vehicle = (String) JOptionPane.showInputDialog(getConsole(), "Force vehicle depth", "Choose vehicle", JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]); if (vehicle != null) { double depth = depths.get(vehicle); String newDepth = JOptionPane.showInputDialog(getConsole(), "New depth", "" + depth); try { double dd = Double.parseDouble(newDepth); depths.put(vehicle, dd); } catch (Exception ex) { GuiUtils.errorMessage(getConsole(), ex); } } } }); add(jPanelMain); renewButtonActionPerformed(null); }
From source file:it.isislab.dmason.util.SystemManagement.Master.thrower.DMasonMaster.java
private void initComponents() { menuBar1 = new JMenuBar(); jMenuFile = new JMenu(); //menuItemOpen = new JMenuItem(); menuItemExit = new JMenuItem(); jMenuAbout = new JMenu(); menuItemInfo = new JMenuItem(); menuItemHelp = new JMenuItem(); panelMain = new JPanel(); jPanelContainerConnection = new JPanel(); jPanelConnection = new JPanel(); jLabelAddress = new JLabel(); textFieldAddress = new JTextField(); jLabelPort = new JLabel(); textFieldPort = new JTextField(); refreshServerLabel = new JLabel(); buttonRefreshServerLabel = new JButton(); jPanelContainerSettings = new JPanel(); jPanelSetDistribution = new JPanel(); jPanelSettings = new JPanel(); jLabelHorizontal = new JLabel(); jLabelSquare = new JLabel(); jLabelMaxDistance = new JLabel(); jLabelWidth = new JLabel(); jLabelInsertSteps = new JLabel(); textFieldMaxDistance = new JTextField(); textFieldWidth = new JTextField(); jLabelHeight = new JLabel(); textFieldHeight = new JTextField(); jLabelAgents = new JLabel(); textFieldAgents = new JTextField(); textFieldColumns = new JTextField(); textFieldRows = new JTextField(); textFieldSteps = new JTextField(); jLabelChooseSimulation = new JLabel(); jComboBoxChooseSimulation = new JComboBox(); jComboBoxNumRegionXPeer = new JComboBox(); jPanelContainerTabbedPane = new JPanel(); tabbedPane2 = new JTabbedPane(); jPanelDefault = new JPanel(); jPanelSimulation = new ModelPanel(tabbedPane2); labelSimulationConfigSet = new JLabel(); labelRegionsResume = new JLabel(); labelNumOfPeerResume = new JLabel(); labelRegForPeerResume = new JLabel(); labelWriteReg = new JLabel(); labelWriteNumOfPeer = new JLabel(); labelWriteRegForPeer = new JLabel(); labelWidthRegion = new JLabel(); labelheightRegion = new JLabel(); labelDistrMode = new JLabel(); labelWriteRegWidth = new JLabel(); labelWriteRegHeight = new JLabel(); labelWriteDistrMode = new JLabel(); graphicONcheckBox2 = new JCheckBox(); jPanelSetButton = new JPanel(); buttonSetConfigDefault = new JButton(); jPanelAdvanced = new JPanel(); jPanelAdvancedMain = new JPanel(); peerInfoStatus = new JDesktopPane(); internalFrame1 = new JInternalFrame(); architectureLabel = new JTextArea(); architectureLabel.setBackground(Color.BLACK); architectureLabel.setForeground(Color.GREEN); architectureLabel.setEditable(false); advancedConfirmBut = new JLabel(); graphicONcheckBox = new JCheckBox(); jCheckBoxLoadBalancing = new JCheckBox("Load Balancing", false); jCheckBoxLoadBalancing.setEnabled(true); jCheckBoxLoadBalancing.setSelected(false); jCheckBoxMPI = new JCheckBox("Enable MPI", false); jCheckBoxMPI.setEnabled(true);// w w w. j a v a 2s.c o m jCheckBoxMPI.setSelected(false); scrollPaneTree = new JScrollPane(); tree1 = new JTree(); buttonSetConfigAdvanced = new JButton(); jLabelPlayButton = new JLabel(); jLabelPauseButton = new JLabel(); jPanelNumStep = new JPanel(); jLabelStep = new JLabel(); jLabelStep.setHorizontalAlignment(SwingConstants.LEFT); jLabelStopButton = new JLabel(); scrollPane1 = new JScrollPane(); peerInfoStatus1 = new JDesktopPane(); root = new DefaultMutableTreeNode("Simulation"); ButtonGroup b = new ButtonGroup(); ip = textFieldAddress.getText(); port = textFieldPort.getText(); menuBar1 = new JMenuBar(); jMenuFile = new JMenu(); menuItemExit = new JMenuItem(); menuNewSim = new JMenuItem(); jMenuAbout = new JMenu(); menuItemInfo = new JMenuItem(); menuItemHelp = new JMenuItem(); scrollPane3 = new JScrollPane(); scrollPane4 = new JScrollPane(); notifyArea = new JTextArea(); panelConsole = new JPanel(); buttonSetConfigDefault2 = new JButton(); jPanelSetButton2 = new JPanel(); graphicONcheckBox = new JCheckBox(); graphicONcheckBox.setEnabled(false); graphicONcheckBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { withGui = graphicONcheckBox.isSelected(); } }); jLabelChooseSimulation = new JLabel(); jComboBoxChooseSimulation = new JComboBox(); loadSimulation(); selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName; jPanelSimulation.updateHTML(selectedSimulation); jComboBoxChooseSimulation.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { // Prevent executing listener's actions two times if (e.getStateChange() != ItemEvent.SELECTED) return; selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName; jPanelSimulation.updateHTML(selectedSimulation); isThin = isThinSimulation(selectedSimulation); jCheckBoxLoadBalancing.setSelected(false); jCheckBoxLoadBalancing.setEnabled(!isThin); initializeDefaultLabel(); } }); /*for(int i=2;i<100;i++) jComboRegions.addItem(i);*/ buttonRefreshServerLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { connect(); } }); refreshServerLabel.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { if (starter.isConnected()) starter.execute("restart"); else JOptionPane.showMessageDialog(null, "Not connected to the Server!"); } @Override public void mousePressed(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseClicked(MouseEvent arg0) { } }); jCheckBoxLoadBalancing.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (!isHorizontal) { if (jCheckBoxLoadBalancing.isSelected()) labelWriteDistrMode.setText("SQUARE BALANCED MODE"); else labelWriteDistrMode.setText("SQUARE MODE"); } if (isHorizontal) { if (jCheckBoxLoadBalancing.isSelected()) labelWriteDistrMode.setText("HORIZONTAL BALANCED MODE"); else labelWriteDistrMode.setText("HORIZONTAL MODE"); } } }); buttonSetConfigDefault2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (initializeDefaultLabel()) submitCustomizeMode(); else JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!"); } }); buttonSetConfigDefault.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (initializeDefaultLabel()) submitDefaultMode(); else JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!"); } }); advancedConfirmBut.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { confirm(); res -= (Integer) jComboBoxNumRegionXPeer.getSelectedItem(); withGui = graphicONcheckBox.isSelected(); jComboBoxNumRegionXPeer.removeAllItems(); graphicONcheckBox.setSelected(false); for (int i = 1; i <= res; i++) jComboBoxNumRegionXPeer.addItem(i); JOptionPane.showMessageDialog(null, "Region assigned !"); } @Override public void mousePressed(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseClicked(MouseEvent arg0) { } }); //======== this ======== Container contentPane = getContentPane(); //======== menuBar1 ======== { { jMenuFile.setText(" File "); menuNewSim.setText("New "); menuNewSim.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { me.dispose(); me = null; DMasonMaster p = new DMasonMaster(); p.setVisible(true); } }); jMenuFile.add(menuNewSim); //---- menuItemExit ---- menuItemExit.setText("Exit"); menuItemExit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { me.dispose(); } }); jMenuFile.add(menuItemExit); } menuBar1.add(jMenuFile); menuBar1.add(getJMenuSystem()); //======== jMenuAbout ======== { jMenuAbout.setText(" ? "); //---- menuItemInfo ---- menuItemInfo.setText("Info"); menuItemInfo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, Release.PRODUCT_RELEASE, "Info", 1); } }); jMenuAbout.add(menuItemInfo); //---- menuItenHelp ---- menuItemHelp.setText("Help"); menuItemHelp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { java.net.URI uri = new java.net.URI( "http://isis.dia.unisa.it/projects/it.isislab.dmason/"); try { java.awt.Desktop.getDesktop().browse(uri); } catch (IOException e) { e.printStackTrace(); } } catch (URISyntaxException e) { e.printStackTrace(); } } }); jMenuAbout.add(menuItemHelp); } menuBar1.add(jMenuAbout); } setJMenuBar(menuBar1); //======== panelMain ======== { //======== jPanelContainerConnection ======== { //======== jPanelConnection ======== { jPanelConnection.setBorder(new TitledBorder("Connection")); jPanelConnection.setPreferredSize(new Dimension(215, 125)); //---- jLabelAddress ---- jLabelAddress.setText("IP Address :"); //---- textFieldAddress ---- textFieldAddress.setText("127.0.0.1"); //---- jLabelPort ---- jLabelPort.setText("Port :"); //---- textFieldPort ---- textFieldPort.setText("61616"); //---- refreshServerLabel ---- refreshServerLabel.setIcon(new ImageIcon("resources/image/refresh.png")); //---- buttonRefreshServerLabel ---- buttonRefreshServerLabel.setText("OK"); JLabel lblStatus = new JLabel("Communication Server status :"); lblStatusIcon = new JLabel(""); lblStatusIcon.setIcon(new ImageIcon("resources/image/status-down.png")); buttonActiveMQRestart = new JButton(""); buttonActiveMQRestart.setEnabled(false); buttonActiveMQRestart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { notifyArea.append("ActiveMQ restarting...\n"); if (csManager.restartActiveMQ()) notifyArea.append("ActiveMQ restarted!\n"); checkCommunicationServerStatus(); } }); buttonActiveMQRestart.setMinimumSize(new Dimension(24, 24)); buttonActiveMQRestart.setMaximumSize(new Dimension(24, 24)); buttonActiveMQRestart.setPreferredSize(new Dimension(24, 24)); buttonActiveMQRestart.setIcon(new ImageIcon("resources/image/LH2 - Restart.png")); buttonActiveMQStart = new JButton(""); buttonActiveMQStart.setEnabled(false); buttonActiveMQStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { notifyArea.append("ActiveMQ starting...\n"); if (csManager.startActiveMQ()) notifyArea.append("ActiveMQ started!\n"); checkCommunicationServerStatus(); } }); buttonActiveMQStart.setPreferredSize(new Dimension(24, 24)); buttonActiveMQStart.setMinimumSize(new Dimension(24, 24)); buttonActiveMQStart.setMaximumSize(new Dimension(24, 24)); buttonActiveMQStart.setIcon(new ImageIcon("resources/image/LH2 - Shutdown.png")); buttonActiveMQStop = new JButton(""); buttonActiveMQStop.setEnabled(false); buttonActiveMQStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { notifyArea.append("ActiveMQ stopping...\n"); if (csManager.stopActiveMQ()) notifyArea.append("ActiveMQ stopped!\n"); checkCommunicationServerStatus(); } }); buttonActiveMQStop.setPreferredSize(new Dimension(24, 24)); buttonActiveMQStop.setMinimumSize(new Dimension(24, 24)); buttonActiveMQStop.setMaximumSize(new Dimension(24, 24)); buttonActiveMQStop.setIcon(new ImageIcon("resources/image/LH2 - Stop.png")); btnCheckPeers = new JButton("Check Peers"); btnCheckPeers.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { checkPeers(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); GroupLayout jPanelConnectionLayout = new GroupLayout(jPanelConnection); jPanelConnectionLayout.setHorizontalGroup(jPanelConnectionLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelConnectionLayout.createSequentialGroup() .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.TRAILING) .addComponent(refreshServerLabel) .addGroup(jPanelConnectionLayout.createSequentialGroup() .addComponent(buttonActiveMQStart, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(buttonActiveMQRestart, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(buttonActiveMQStop, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(111).addComponent(jLabelAddress).addGap(18) .addComponent(textFieldAddress, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE) .addGap(18).addComponent(jLabelPort).addGap(18) .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) .addGap(46).addComponent(buttonRefreshServerLabel))) .addGap(51).addComponent(btnCheckPeers)) .addGroup(jPanelConnectionLayout.createSequentialGroup().addComponent(lblStatus) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblStatusIcon))) .addContainerGap(71, Short.MAX_VALUE))); jPanelConnectionLayout.setVerticalGroup(jPanelConnectionLayout .createParallelGroup(Alignment.TRAILING) .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelConnectionLayout.createSequentialGroup() .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING) .addComponent(lblStatus).addComponent(lblStatusIcon)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING) .addComponent(buttonActiveMQRestart, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonActiveMQStart, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonActiveMQStop, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, 1, Short.MAX_VALUE)) .addGroup(jPanelConnectionLayout.createSequentialGroup() .addContainerGap(18, Short.MAX_VALUE).addComponent(refreshServerLabel) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.BASELINE) .addComponent(buttonRefreshServerLabel).addComponent(jLabelPort) .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelAddress) .addComponent(textFieldAddress, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(btnCheckPeers)))) .addGap(10))); jPanelConnectionLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { buttonActiveMQRestart, buttonActiveMQStart, buttonActiveMQStop }); jPanelConnection.setLayout(jPanelConnectionLayout); } GroupLayout jPanelContainerConnectionLayout = new GroupLayout(jPanelContainerConnection); jPanelContainerConnection.setLayout(jPanelContainerConnectionLayout); jPanelContainerConnectionLayout .setHorizontalGroup(jPanelContainerConnectionLayout.createParallelGroup() .addGroup(jPanelContainerConnectionLayout .createSequentialGroup().addContainerGap().addComponent(jPanelConnection, GroupLayout.PREFERRED_SIZE, 829, GroupLayout.PREFERRED_SIZE) .addContainerGap(153, Short.MAX_VALUE))); jPanelContainerConnectionLayout.setVerticalGroup( jPanelContainerConnectionLayout.createParallelGroup().addComponent(jPanelConnection, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)); } //======== jPanelContainerSettings ======== { GroupLayout jPanelContainerSettingsLayout = new GroupLayout(jPanelContainerSettings); jPanelContainerSettings.setLayout(jPanelContainerSettingsLayout); jPanelContainerSettingsLayout.setHorizontalGroup( jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 1, Short.MAX_VALUE)); jPanelContainerSettingsLayout.setVerticalGroup( jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 481, Short.MAX_VALUE)); } //======== jPanelSetDistribution ======== { jPanelSetDistribution.setBorder(new TitledBorder("Settings")); //======== jPanelSettings ======== { //jLabelHorizontal.setIcon(new ImageIcon("it.isislab.dmason/resources/image/hori.png"))); //---- jLabelSquare ---- //jLabelSquare.setIcon(new ImageIcon("it.isislab.dmason/resources/image/square.png"))); //---- jLabelMaxDistance ---- jLabelMaxDistance.setText("MAX_DISTANCE :"); //---- jLabelWidth ---- jLabelWidth.setText("WIDTH :"); //---- jLabelInsertSteps ---- jLabelInsertSteps.setText("STEPS :"); //---- textFieldMaxDistance ---- textFieldMaxDistance.setText("1"); //---- textFieldWidth ---- textFieldWidth.setText("200"); //---- jLabelHeight ---- jLabelHeight.setText("HEIGHT :"); //---- textFieldHeight ---- textFieldHeight.setText("200"); //---- jLabelAgents ---- jLabelAgents.setText("AGENTS :"); //---- textFieldAgents ---- textFieldAgents.setText("15"); //---- textFieldSteps textFieldSteps.setText("100"); MouseListener textFieldMouseListener = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { initializeDefaultLabel(); } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } }; textFieldAgents.addMouseListener(textFieldMouseListener); textFieldAgents.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldAgents.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { //initializeDefaultLabel(); } @Override public void keyPressed(KeyEvent e) { } }); textFieldColumns.addMouseListener(textFieldMouseListener); textFieldColumns.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldColumns.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); textFieldMaxDistance.addMouseListener(textFieldMouseListener); textFieldMaxDistance.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldMaxDistance.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { //initializeDefaultLabel(); } @Override public void keyPressed(KeyEvent e) { } }); textFieldWidth.addMouseListener(textFieldMouseListener); textFieldWidth.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldWidth.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { //initializeDefaultLabel(); } @Override public void keyPressed(KeyEvent e) { } }); textFieldRows.addMouseListener(textFieldMouseListener); textFieldRows.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldRows.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); textFieldHeight.addMouseListener(textFieldMouseListener); textFieldHeight.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldHeight.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent arg0) { //initializeDefaultLabel(); } @Override public void keyPressed(KeyEvent arg0) { } }); textFieldSteps.addMouseListener(textFieldMouseListener); textFieldSteps.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { char v = e.getKeyChar(); if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) { e.consume(); } if (textFieldSteps.getText().length() > 0) initializeDefaultLabel(); } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); //---- jLabelChooseSimulation ---- jLabelChooseSimulation.setText("Choose your simulation:"); //---- jComboBoxChooseSimulation ---- jComboBoxChooseSimulation.setMaximumRowCount(10); JLabel lblRows = new JLabel("ROWS :"); JLabel lblColumns = new JLabel("COLUMNS :"); textFieldRows.setText("1"); textFieldRows.setEnabled(false); textFieldRows.setColumns(10); rows = Integer.parseInt(textFieldRows.getText()); textFieldColumns.setText("2"); textFieldColumns.setEnabled(false); textFieldColumns.setColumns(10); columns = Integer.parseInt(textFieldColumns.getText()); textFieldSteps.setText("100"); textFieldSteps.setEnabled(false); textFieldSteps.setColumns(10); steps = 100; GroupLayout jPanelSettingsLayout = new GroupLayout(jPanelSettings); jPanelSettingsLayout.setHorizontalGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(17) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING) .addComponent(jLabelChooseSimulation, GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE) .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(119) .addComponent(jLabelHorizontal)) .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE) .addGroup(jPanelSettingsLayout.createSequentialGroup() .addGroup(jPanelSettingsLayout .createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, jPanelSettingsLayout .createSequentialGroup() .addGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addComponent(lblRows, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE) .addComponent(lblColumns)) .addGap(60) .addGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addComponent(jLabelSquare) .addComponent(textFieldColumns, GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE) .addComponent(textFieldRows, GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE))) .addGroup(Alignment.LEADING, jPanelSettingsLayout .createSequentialGroup() .addGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addComponent(jLabelMaxDistance) .addComponent(jLabelWidth) .addComponent(jLabelHeight) .addComponent(jLabelAgents) .addComponent(jLabelInsertSteps) .addGap(132)) .addGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addComponent(textFieldAgents, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldHeight, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldWidth, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldMaxDistance, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldSteps, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addGap(20)))) .addGap(20))))); jPanelSettingsLayout.setVerticalGroup(jPanelSettingsLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelSettingsLayout.createSequentialGroup().addContainerGap() .addComponent(jLabelHorizontal).addGap(41) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING) .addComponent(jLabelSquare) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblRows, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldRows, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(textFieldColumns, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblColumns)) .addGap(18) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabelMaxDistance).addComponent(textFieldMaxDistance, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabelWidth, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldWidth, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addGap(10) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabelHeight, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldHeight, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabelAgents).addComponent(textFieldAgents, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) //.addGap(10) .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabelInsertSteps, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldSteps, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addGap(35).addComponent(jLabelChooseSimulation) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(52))); jPanelSettings.setLayout(jPanelSettingsLayout); } //======== jPanelContainerTabbedPane ======== { //======== tabbedPane2 ======== { //======== jPanelDefault ======== { jPanelDefault.setBorder(new EtchedBorder()); jPanelDefault.setPreferredSize(new Dimension(350, 331)); //---- labelSimulationConfigSet ---- labelSimulationConfigSet.setText("Simulation Configuration Settings"); labelSimulationConfigSet.setFont(labelSimulationConfigSet.getFont().deriveFont( labelSimulationConfigSet.getFont().getStyle() | Font.BOLD, labelSimulationConfigSet.getFont().getSize() + 8f)); //---- labelRegionsResume ---- labelRegionsResume.setText("REGIONS :"); //---- labelNumOfPeerResume ---- labelNumOfPeerResume.setText("NUMBER OF PEERS :"); //---- labelRegForPeerResume ---- labelRegForPeerResume.setText("REGIONS FOR PEER :"); //---- labelWriteReg ---- labelWriteReg.setText("text"); //---- labelWriteNumOfPeer ---- labelWriteNumOfPeer.setText("text"); //---- labelWriteRegForPeer ---- labelWriteRegForPeer.setText("text"); //---- labelWidthRegion ---- labelWidthRegion.setText("REGION WIDTH :"); //---- labelheightRegion ---- labelheightRegion.setText("REGION HEIGHT :"); //---- labelDistrMode ---- labelDistrMode.setText("DISTRIBUTION MODE :"); //---- labelWriteRegWidth ---- labelWriteRegWidth.setText("text"); //---- labelWriteRegHeight ---- labelWriteRegHeight.setText("text"); //---- labelWriteDistrMode ---- labelWriteDistrMode.setText("text"); //---- graphicONcheckBox2 ---- graphicONcheckBox2.setText("Graphic ON"); //======== jPanelSetButton ======== { //---- buttonSetConfigDefault ---- buttonSetConfigDefault.setText("Set"); { jCheckBoxLoadBalancing.setText("Load Balancing"); } GroupLayout jPanelSetButtonLayout = new GroupLayout(jPanelSetButton); jPanelSetButton.setLayout(jPanelSetButtonLayout); jPanelSetButtonLayout.setVerticalGroup(jPanelSetButtonLayout.createSequentialGroup() .addGroup(jPanelSetButtonLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, jPanelSetButtonLayout.createSequentialGroup().addComponent( jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))) .addGroup(jPanelSetButtonLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jPanelSetButtonLayout.createSequentialGroup().addComponent( jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jPanelSetButtonLayout .createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE) .addComponent(buttonSetConfigDefault, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap()); jPanelSetButtonLayout.setHorizontalGroup(jPanelSetButtonLayout .createSequentialGroup() .addComponent(jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addContainerGap(0, 0) .addComponent(jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114, GroupLayout.PREFERRED_SIZE) .addGap(0, 150, Short.MAX_VALUE).addComponent(buttonSetConfigDefault, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE) .addContainerGap(0, 0)); FlowLayout lsetbutt = new FlowLayout(); lsetbutt.addLayoutComponent("", jCheckBoxMPI); lsetbutt.addLayoutComponent("", jCheckBoxLoadBalancing); lsetbutt.addLayoutComponent("", buttonSetConfigDefault); jPanelSetButton.setLayout(lsetbutt); } GroupLayout jPanelDefaultLayout = new GroupLayout(jPanelDefault); jPanelDefaultLayout.setHorizontalGroup(jPanelDefaultLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap() .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.LEADING) .addComponent(labelSimulationConfigSet, GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE) .addGroup(jPanelDefaultLayout.createSequentialGroup().addGap(6) .addGroup(jPanelDefaultLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelDefaultLayout .createSequentialGroup() .addGroup(jPanelDefaultLayout .createParallelGroup( Alignment.LEADING) .addComponent( labelNumOfPeerResume) .addComponent( labelRegForPeerResume) .addComponent(labelWidthRegion) .addComponent(labelheightRegion) .addComponent(labelDistrMode) .addComponent( labelRegionsResume)) .addPreferredGap( ComponentPlacement.RELATED, 218, Short.MAX_VALUE) .addGroup(jPanelDefaultLayout .createParallelGroup( Alignment.LEADING) .addComponent( labelWriteNumOfPeer, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(labelWriteReg) .addComponent( labelWriteRegForPeer) .addComponent( labelWriteRegWidth) .addComponent( labelWriteRegHeight) .addComponent( labelWriteDistrMode)) .addGap(118)) .addComponent(graphicONcheckBox2)))) .addGap(211)) .addGroup(jPanelDefaultLayout.createSequentialGroup() .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(23, Short.MAX_VALUE))); jPanelDefaultLayout.setVerticalGroup(jPanelDefaultLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap() .addComponent(labelSimulationConfigSet, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addGap(28) .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanelDefaultLayout.createSequentialGroup() .addComponent(labelRegionsResume) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelNumOfPeerResume) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelRegForPeerResume).addGap(6) .addComponent(labelWidthRegion).addGap(6) .addComponent(labelheightRegion) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelDistrMode)) .addGroup(jPanelDefaultLayout.createSequentialGroup() .addComponent(labelWriteReg) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelWriteNumOfPeer) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelWriteRegForPeer).addGap(6) .addComponent(labelWriteRegWidth).addGap(6) .addComponent(labelWriteRegHeight) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(labelWriteDistrMode, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addGap(8))) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(graphicONcheckBox2) .addPreferredGap(ComponentPlacement.RELATED, 82, Short.MAX_VALUE) .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))); jPanelDefault.setLayout(jPanelDefaultLayout); } tabbedPane2.addTab("Default", jPanelDefault); //======== jPanelSimulation ======== tabbedPane2.addTab("Simulation", jPanelSimulation); //======== End jPanelSimulation ======== //======== jPanelAdvanced ======== { jPanelAdvanced.setBorder(new EtchedBorder()); //======== jPanelAdvancedMain ======== { //======== scrollPaneTree ======== { //---- tree1 ---- tree1.setModel(new DefaultTreeModel(root)); DefaultTreeCellRenderer render = new DefaultTreeCellRenderer(); render.setOpenIcon(new ImageIcon("resources/image/network.png")); render.setLeafIcon(new ImageIcon("esource/image/computer.gif")); render.setClosedIcon(new ImageIcon("resources/image/network.png")); tree1.setCellRenderer(render); tree1.setRowHeight(25); scrollPaneTree.setViewportView(tree1); tree1.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent arg0) { if (arg0.getPath().getLastPathComponent().equals(root)) { jComboBoxNumRegionXPeer.setEnabled(true); advancedConfirmBut.setEnabled(true); graphicONcheckBox.setEnabled(true); total = Integer.parseInt(textFieldRows.getText()) * Integer.parseInt(textFieldColumns.getText()); //(Integer)jComboRegions.getSelectedItem(); res = total; jComboBoxNumRegionXPeer.removeAllItems(); for (int i = 1; i < res; i++) jComboBoxNumRegionXPeer.addItem(i); } else clickTreeListener(); } }); } //======== peerInfoStatus ======== { peerInfoStatus.setBorder(new TitledBorder("Settings")); peerInfoStatus.setBackground(Color.lightGray); //======== peerInfoStatus1 ======== { peerInfoStatus1.setBackground(Color.lightGray); peerInfoStatus1.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); peerInfoStatus1.setBorder(null); //======== internalFrame1 ======== { internalFrame1.setVisible(true); Container internalFrame1ContentPane = internalFrame1.getContentPane(); //======== scrollPane1 ======== { //---- label8 ---- architectureLabel.setText("Architecture Information"); scrollPane1.setViewportView(architectureLabel); } GroupLayout internalFrame1ContentPaneLayout = new GroupLayout( internalFrame1ContentPane); internalFrame1ContentPane.setLayout(internalFrame1ContentPaneLayout); internalFrame1ContentPaneLayout.setHorizontalGroup( internalFrame1ContentPaneLayout.createParallelGroup() .addGroup(internalFrame1ContentPaneLayout .createSequentialGroup().addContainerGap() .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE) .addContainerGap())); internalFrame1ContentPaneLayout.setVerticalGroup( internalFrame1ContentPaneLayout.createParallelGroup() .addGroup(internalFrame1ContentPaneLayout .createSequentialGroup().addContainerGap() .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE) .addContainerGap())); } peerInfoStatus1.add(internalFrame1, JLayeredPane.DEFAULT_LAYER); internalFrame1.setBounds(15, 0, 365, 160); } //---- graphicONcheckBox ---- graphicONcheckBox.setText("Graphic ON"); //---- advancedConfirmBut ---- advancedConfirmBut.setIcon(new ImageIcon("resources/image/ok.png")); GroupLayout peerInfoStatusLayout = new GroupLayout(peerInfoStatus); peerInfoStatus.setLayout(peerInfoStatusLayout); peerInfoStatusLayout.setHorizontalGroup(peerInfoStatusLayout .createParallelGroup() .addGroup(peerInfoStatusLayout.createSequentialGroup() .addGroup(peerInfoStatusLayout.createParallelGroup() .addGroup(peerInfoStatusLayout.createSequentialGroup() .addGap(26, 26, 26) .addComponent(graphicONcheckBox) .addGap(73, 73, 73) .addComponent(jComboBoxNumRegionXPeer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(80, 80, 80) .addComponent(advancedConfirmBut, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) .addGroup(peerInfoStatusLayout.createSequentialGroup() .addContainerGap().addComponent(peerInfoStatus1, GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE))) .addContainerGap())); peerInfoStatusLayout.setVerticalGroup(peerInfoStatusLayout.createParallelGroup() .addGroup(peerInfoStatusLayout.createSequentialGroup() .addComponent(peerInfoStatus1, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(peerInfoStatusLayout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(GroupLayout.Alignment.LEADING, peerInfoStatusLayout .createParallelGroup( GroupLayout.Alignment.BASELINE) .addComponent(graphicONcheckBox) .addComponent(jComboBoxNumRegionXPeer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(advancedConfirmBut, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)) .addContainerGap(16, Short.MAX_VALUE))); } GroupLayout jPanelAdvancedMainLayout = new GroupLayout(jPanelAdvancedMain); jPanelAdvancedMain.setLayout(jPanelAdvancedMainLayout); jPanelAdvancedMainLayout.setHorizontalGroup(jPanelAdvancedMainLayout .createParallelGroup() .addGroup(jPanelAdvancedMainLayout.createSequentialGroup().addContainerGap() .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 207, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(peerInfoStatus, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jPanelAdvancedMainLayout.setVerticalGroup(jPanelAdvancedMainLayout .createParallelGroup() .addGroup(GroupLayout.Alignment.TRAILING, jPanelAdvancedMainLayout .createSequentialGroup().addContainerGap() .addGroup(jPanelAdvancedMainLayout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(peerInfoStatus, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(scrollPaneTree, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)) .addContainerGap())); } //======== jPanelSetButton2 ======== { //---- buttonSetConfigDefault2 ---- buttonSetConfigDefault2.setText("Set"); GroupLayout jPanelSetButton2Layout = new GroupLayout(jPanelSetButton2); jPanelSetButton2.setLayout(jPanelSetButton2Layout); jPanelSetButton2Layout.setHorizontalGroup(jPanelSetButton2Layout .createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, jPanelSetButton2Layout.createSequentialGroup() .addContainerGap(522, Short.MAX_VALUE) .addComponent(buttonSetConfigDefault2, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE) .addGap(72, 72, 72))); jPanelSetButton2Layout.setVerticalGroup(jPanelSetButton2Layout.createParallelGroup() .addGroup(GroupLayout.Alignment.TRAILING, jPanelSetButton2Layout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonSetConfigDefault2).addContainerGap())); } GroupLayout jPanelAdvancedLayout = new GroupLayout(jPanelAdvanced); jPanelAdvancedLayout.setHorizontalGroup(jPanelAdvancedLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelAdvancedLayout.createSequentialGroup() .addGroup(jPanelAdvancedLayout.createParallelGroup(Alignment.LEADING) .addComponent(jPanelAdvancedMain, GroupLayout.DEFAULT_SIZE, 689, Short.MAX_VALUE) .addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE, 681, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanelAdvancedLayout.setVerticalGroup(jPanelAdvancedLayout .createParallelGroup(Alignment.TRAILING) .addGroup(jPanelAdvancedLayout.createSequentialGroup().addContainerGap() .addComponent(jPanelAdvancedMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18).addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))); jPanelAdvanced.setLayout(jPanelAdvancedLayout); } tabbedPane2.addTab("Advanced", jPanelAdvanced); } //======== panelConsole ======== { //======== scrollPane3 ======== { //---- textField1 ---- notifyArea.setEditable(false); DefaultCaret caret = (DefaultCaret) notifyArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); scrollPane3.setViewportView(notifyArea); } GroupLayout panelConsoleLayout = new GroupLayout(panelConsole); panelConsole.setLayout(panelConsoleLayout); panelConsoleLayout.setHorizontalGroup(panelConsoleLayout.createParallelGroup() .addGroup(panelConsoleLayout.createParallelGroup() .addGroup(panelConsoleLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 679, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addGap(0, 679, Short.MAX_VALUE)); panelConsoleLayout.setVerticalGroup(panelConsoleLayout.createParallelGroup() .addGroup(panelConsoleLayout.createParallelGroup() .addGroup(panelConsoleLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addGap(0, 76, Short.MAX_VALUE)); } GroupLayout jPanelContainerTabbedPaneLayout = new GroupLayout(jPanelContainerTabbedPane); jPanelContainerTabbedPaneLayout.setHorizontalGroup(jPanelContainerTabbedPaneLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addContainerGap() .addGroup(jPanelContainerTabbedPaneLayout.createParallelGroup(Alignment.LEADING) .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 686, GroupLayout.PREFERRED_SIZE) .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 708, Short.MAX_VALUE)) .addContainerGap())); jPanelContainerTabbedPaneLayout.setVerticalGroup(jPanelContainerTabbedPaneLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addGap(3) .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 384, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE))); jPanelContainerTabbedPane.setLayout(jPanelContainerTabbedPaneLayout); } { jPanelDeploying = new JPanel(); tabbedPane2.addTab("Simulation Jar", null, jPanelDeploying, null); GroupLayout jPanelDeployingLayout = new GroupLayout(jPanelDeploying); jPanelDeploying.setLayout(jPanelDeployingLayout); { jButtonLoadJar = new JButton(); jButtonLoadJar.setText("Load Jar"); jButtonLoadJar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (simulationFile != null) { File dest = new File(FTP_HOME + dirSeparator + SIMULATION_DIR + dirSeparator + simulationFile.getName()); try { FileUtils.copyFile(simulationFile, dest); Digester dg = new Digester(DigestAlgorithm.MD5); InputStream in = new FileInputStream(dest); Properties prop = new Properties(); try { prop.setProperty("MD5", dg.getDigest(in)); String fileName = FilenameUtils .removeExtension(simulationFile.getName()); //save properties to project root folder prop.store(new FileOutputStream(FTP_HOME + dirSeparator + SIMULATION_DIR + dirSeparator + fileName + ".hash"), null); } catch (IOException ex) { ex.printStackTrace(); } System.out.println("MD5: " + dg.getDigest(in)); loadSimulation(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); } jPanelDeployingLayout.setVerticalGroup(jPanelDeployingLayout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(jPanelDeployingLayout.createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, jPanelDeployingLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButtonLoadJar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJTextFieldPathSimJar(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(getJButtonChoseSimJar(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 286, GroupLayout.PREFERRED_SIZE)); jPanelDeployingLayout .setHorizontalGroup(jPanelDeployingLayout.createSequentialGroup().addGap(22, 22, 22) .addComponent(getJTextFieldPathSimJar(), GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJButtonChoseSimJar(), GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addGap(24) .addComponent(jButtonLoadJar, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 155, Short.MAX_VALUE)); } jPanelRunBatchTests = new JPanel(); tabbedPane2.addTab("Run batch tests", null, jPanelRunBatchTests, null); JLabel lblSelectConfigurationFile = new JLabel("Select configuration file:"); textFieldConfigFilePath = new JTextField(); textFieldConfigFilePath.setColumns(10); JButton buttonChooseConfigFile = new JButton(); buttonChooseConfigFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { configFile = showFileChooser(); if (configFile != null) textFieldConfigFilePath.setText(configFile.getAbsolutePath()); } }); buttonChooseConfigFile.setIcon(new ImageIcon("it/isislab/dmason/resources/image/openFolder.png")); JButton buttonLoadConfig = new JButton("Start"); buttonLoadConfig.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (configFile.getName().contains(".xml")) { ClassLoader.getSystemClassLoader(); //File xsd = new File(xsdFilename); InputStream xsd = new FileInputStream("resources/batch/batchSchema.xsd"); if (xsd != null) { if (validateXML(configFile, xsd)) { Batch batch = loadConfigFromXML(configFile); if (batch != null) { textAreaBatchInfo.append(configFile.getName() + " loaded.\n"); if (batch.getNeededWorkers() > peers.size() || batch.getNeededWorkers() == 0) JOptionPane.showMessageDialog(DMasonMaster.this, "There are not enough workers to start the simulation"); else { textAreaBatchInfo .append("Simulation: " + batch.getSimulationName() + "\n"); textAreaBatchInfo.append( "Needed Worker: " + batch.getNeededWorkers() + "\n"); textAreaBatchInfo.append("Balance: " + batch.isBalanced() + "\n"); Set<List<EntryParam<String, Object>>> testList = generateTestsFrom( batch); textAreaBatchInfo .append("--------------------------------------\n"); textAreaBatchInfo .append("Number of experiments: " + testList.size() + "\n"); ConcurrentLinkedQueue<List<EntryParam<String, Object>>> testQueue = new ConcurrentLinkedQueue<List<EntryParam<String, Object>>>(); for (List<EntryParam<String, Object>> test : testList) testQueue.offer(test); //System.out.println("Test queue: "+testQueue.size()); try { List<List<EntryWorkerScore<Integer, String>>> workersPartition = Util .chopped(scoreList, batch.getNeededWorkers()); //System.out.println(workersPartition.toString()); testCount.set(0); totalTests = testList.size(); progressBarBatchTest.setValue(0); progressBarBatchTest.setString("0 %"); progressBarBatchTest.setStringPainted(true); batchLogger = Logger .getLogger(BatchExecutor.class.getCanonicalName()); batchStartedTime = System.currentTimeMillis(); textAreaBatchInfo.append("Batch started at: " + Util.getCurrentDateTime(batchStartedTime) + "\n"); textAreaBatchInfo .append("--------------------------------------\n"); batchLogger.debug("Started at: " + batchStartedTime); int i = 1; BatchExecutor batchExec; for (List<EntryWorkerScore<Integer, String>> workers : workersPartition) { try { batchExec = new BatchExecutor(batch.getSimulationName(), batch.isBalanced(), testQueue, master, connection, root.getChildCount(), getFPTAddress(), workers, "Batch" + i, 1, textAreaBatchInfo); batchExec.getObservable() .addObserver(DMasonMaster.this); batchExec.start(); //Thread.sleep(2000); //textAreaBatchInfo.append("Batch Executor "+i+" started\n"); i++; //not paraller simulation, I use only one batch executor if (!chckbxParallelBatch.isSelected()) break; } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } catch (Exception e3) { // TODO Auto-generated catch block e3.printStackTrace(); } } } else JOptionPane.showMessageDialog(DMasonMaster.this, "Error when loading config file"); } else JOptionPane.showMessageDialog(DMasonMaster.this, "The configuration file is not a valid file"); } else JOptionPane.showMessageDialog(DMasonMaster.this, xsdFilename + " not exists, can't validate configuration file."); } else JOptionPane.showMessageDialog(DMasonMaster.this, "The file " + configFile.getName() + "is not a configuration file."); } catch (HeadlessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Batch Status", TitledBorder.LEADING, TitledBorder.TOP, null, null)); chckbxParallelBatch = new JCheckBox("Parallel Batch"); GroupLayout gl_jPanelRunBatchTests = new GroupLayout(jPanelRunBatchTests); gl_jPanelRunBatchTests.setHorizontalGroup(gl_jPanelRunBatchTests .createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap() .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanelRunBatchTests.createSequentialGroup() .addComponent(lblSelectConfigurationFile, GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE) .addGap(10).addComponent(buttonChooseConfigFile, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_jPanelRunBatchTests.createSequentialGroup() .addComponent(chckbxParallelBatch).addGap(18) .addComponent(buttonLoadConfig)) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 666, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); gl_jPanelRunBatchTests.setVerticalGroup(gl_jPanelRunBatchTests .createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap() .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.TRAILING) .addComponent(buttonChooseConfigFile, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblSelectConfigurationFile)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.BASELINE) .addComponent(chckbxParallelBatch).addComponent(buttonLoadConfig)) .addPreferredGap(ComponentPlacement.RELATED, 14, Short.MAX_VALUE) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE) .addContainerGap())); progressBarBatchTest = new JProgressBar(); JLabel lblProgress = new JLabel("Progress:"); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel .createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addComponent(scrollPane4, GroupLayout.DEFAULT_SIZE, 641, Short.MAX_VALUE) .addGroup(gl_panel.createSequentialGroup().addComponent(lblProgress).addGap(18) .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE, 169, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblProgress) .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(scrollPane4, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel.setLayout(gl_panel); jPanelRunBatchTests.setLayout(gl_jPanelRunBatchTests); GroupLayout jPanelSetDistributionLayout = new GroupLayout(jPanelSetDistribution); jPanelSetDistributionLayout .setHorizontalGroup( jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING) .addGroup(jPanelSetDistributionLayout.createSequentialGroup() .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE, 254, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(jPanelContainerTabbedPane, GroupLayout.PREFERRED_SIZE, 707, GroupLayout.PREFERRED_SIZE) .addContainerGap(21, Short.MAX_VALUE))); jPanelSetDistributionLayout.setVerticalGroup(jPanelSetDistributionLayout .createParallelGroup(Alignment.LEADING) .addGroup(jPanelSetDistributionLayout.createSequentialGroup() .addGroup(jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING) .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jPanelContainerTabbedPane, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanelSetDistribution.setLayout(jPanelSetDistributionLayout); } textAreaBatchInfo = new JTextArea(); textAreaBatchInfo.setEditable(false); DefaultCaret caret = (DefaultCaret) textAreaBatchInfo.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); scrollPane4.setViewportView(textAreaBatchInfo); //---- jLabelPlayButton ---- jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotStopped.png")); //---- jLabelPauseButton ---- jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png")); //---- labelStopButton ---- jLabelPlayButton.setIcon(new ImageIcon("image/NotPlaying.png")); jLabelPlayButton.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseClicked(MouseEvent arg0) { jLabelPlayButton.setIcon(new ImageIcon("resources/image/Playing.png")); jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png")); jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png")); jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png")); try { master.play(); } catch (Exception e) { e.printStackTrace(); } } }); //---- labelStopButton2 ---- jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png")); jLabelStopButton.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { jLabelStopButton.setIcon(new ImageIcon("resources/image/Stopped.png")); jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png")); jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png")); try { Address FTPAddress = getFPTAddress(); if (FTPAddress != null) { UpdateData ud = new UpdateData("", FTPAddress); master.stop(ud); } } catch (Exception e1) { e1.printStackTrace(); } } }); //---- labelPauseButton ---- jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png")); jLabelPauseButton.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOn.png")); jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png")); jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png")); try { master.pause(); } catch (Exception e1) { e1.printStackTrace(); } } }); //======== jPanelNumStep ======== { GroupLayout jPanelNumStepLayout = new GroupLayout(jPanelNumStep); jPanelNumStepLayout.setHorizontalGroup( jPanelNumStepLayout.createParallelGroup(Alignment.TRAILING).addGap(0, 25, Short.MAX_VALUE)); jPanelNumStepLayout.setVerticalGroup( jPanelNumStepLayout.createParallelGroup(Alignment.LEADING).addGap(0, 28, Short.MAX_VALUE)); jPanelNumStep.setLayout(jPanelNumStepLayout); jPanelNumStep.setPreferredSize(new java.awt.Dimension(89, 23)); } { jLabelResetButton = new JLabel(); jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png")); jLabelResetButton.setPreferredSize(new java.awt.Dimension(20, 20)); jLabelResetButton.setVisible(enableReset); } // for resetting simulation jLabelResetButton.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (connected) { jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png")); jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png")); jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png")); jLabelResetButton.setIcon(new ImageIcon("resources/image/Reload.png")); //send message to workers for resetting simulation try { master.reset(); } catch (Exception e1) { e1.printStackTrace(); } //clean up topic from AcitveMQ connection.resetTopic(); setSystemSettingsEnabled(true); notifyArea.append("Simulation resetted\n"); } } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } }); writeStepLabel = new JLabel(); writeStepLabel.setText("0"); lblTotalSteps = new JLabel("Steps:"); GroupLayout panelMainLayout = new GroupLayout(panelMain); panelMainLayout.setHorizontalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addGroup(panelMainLayout.createSequentialGroup() .addComponent(jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addComponent(jPanelSetDistribution, 0, 986, Short.MAX_VALUE) .addGroup(panelMainLayout.createSequentialGroup().addGap(636) .addGroup(panelMainLayout.createParallelGroup(Alignment.TRAILING) .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(panelMainLayout.createSequentialGroup() .addComponent(lblTotalSteps) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(writeStepLabel))) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(jPanelNumStep, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addGroup(panelMainLayout.createSequentialGroup().addGap(24) .addComponent(jLabelPlayButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabelPauseButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabelStopButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(panelMainLayout.createSequentialGroup().addGap(116) .addComponent(jLabelResetButton, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))) .addGap(12)) .addComponent(jPanelContainerConnection, 0, 1004, Short.MAX_VALUE)); panelMainLayout.setVerticalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addGroup(panelMainLayout.createSequentialGroup() .addComponent(jPanelContainerConnection, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addComponent(jPanelSetDistribution, GroupLayout.PREFERRED_SIZE, 518, GroupLayout.PREFERRED_SIZE) .addGroup(panelMainLayout.createSequentialGroup().addGap(29).addComponent( jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 489, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING) .addComponent(jLabelStopButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelPlayButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelPauseButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelResetButton, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addGroup(panelMainLayout.createParallelGroup(Alignment.BASELINE) .addComponent(writeStepLabel, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addComponent(lblTotalSteps)) .addGroup(panelMainLayout.createSequentialGroup() .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(jPanelNumStep, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))) .addContainerGap(13, Short.MAX_VALUE))); panelMain.setLayout(panelMainLayout); } GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPaneLayout.setHorizontalGroup( contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, contentPaneLayout .createSequentialGroup().addContainerGap().addComponent(panelMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); contentPaneLayout.setVerticalGroup( contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addContainerGap().addComponent(panelMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); contentPane.setLayout(contentPaneLayout); pack(); setLocationRelativeTo(null); refreshServerLabel.setVisible(false); jButtonChoseSimJar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { simulationFile = showFileChooser(); if (simulationFile != null) jTextFieldPathSimJar.setText(simulationFile.getAbsolutePath()); } }); }
From source file:SuitaDetails.java
public ParamPanel() { setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)), "Parameters", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 0, 0))); setBackground(Color.WHITE);//ww w . j a va 2s . c om jPanel2 = new JPanel(); jPanel2.setBackground(Color.WHITE); JScrollPane jScrollPane3 = new JScrollPane(jPanel2); jScrollPane3.setBackground(Color.WHITE); jScrollPane3.setBorder(null); jPanel2.setLayout(new BoxLayout(jPanel2, BoxLayout.Y_AXIS)); addpanel = new JPanel(); addpanel.setMaximumSize(new Dimension(32767, 25)); addpanel.setMinimumSize(new Dimension(0, 25)); addpanel.setPreferredSize(new Dimension(50, 25)); addpanel.setLayout(new BorderLayout()); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone(); indexpos3.add(new Integer(parent.getSubItemsNr())); Item property = new Item("param", 0, -1, -1, 10, 20, indexpos3); property.setSubItemVisible(false); property.setValue(""); parent.addSubItem(property); Param prop = new Param(parent, property); jPanel2.remove(addpanel); jPanel2.add(prop); jPanel2.add(addpanel); jPanel2.revalidate(); jPanel2.repaint(); } }); addpanel.add(add, BorderLayout.EAST); addpanel.setBackground(Color.WHITE); GroupLayout paramLayout = new GroupLayout(this); this.setLayout(paramLayout); paramLayout.setHorizontalGroup( paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3)); paramLayout.setVerticalGroup( paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3)); }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JPanel getJMemory3DPanel() { if (jMemory3DPanel == null) { jMemory3DPanel = new JPanel(); GroupLayout jMemory3DPanelLayout = new GroupLayout((JComponent) jMemory3DPanel); jMemory3DPanel.setLayout(jMemory3DPanelLayout); jMemory3DPanel.setPreferredSize(new java.awt.Dimension(890, 242)); jMemory3DPanel.setVisible(false); try {/*from w ww.j ava2s .c o m*/ memory3dChart = createEmptyMemory3DChart(); ChartMouseController mouse = new ChartMouseController(); // mouse.addControllerEventListener(new // ControllerEventListener() { // // public void controllerEventFired(ControllerEvent e) { // if (e.getType() == ControllerType.ROTATE) { // // System.out.println("Mouse[ROTATE]:" + // // (Coord3d)e.getValue()); // // } // // } // // }); memory3dChart.addController(mouse); jMemory3DPanelLayout .setHorizontalGroup(jMemory3DPanelLayout.createSequentialGroup().addContainerGap() .addComponent((Component) memory3dChart.getCanvas(), 0, 220, Short.MAX_VALUE) .addContainerGap()); jMemory3DPanelLayout.setVerticalGroup(jMemory3DPanelLayout.createSequentialGroup().addContainerGap() .addComponent((Component) memory3dChart.getCanvas(), 0, 116, Short.MAX_VALUE) .addContainerGap()); // GLCapabilities glCapabilities = new GLCapabilities(); // glCapabilities.setHardwareAccelerated(true); } catch (UnsatisfiedLinkError e) { jMemory3DPanel = new JPanel(); jMemory3DPanel.add(new JLabel( "Error : no gluegen-rt in java.library.path, to fix it, please add -Djava.library.path=<directory that contains libgluegen-rt.so>")); } } return jMemory3DPanel; }
From source file:SuitaDetails.java
public PropPanel() { jPanel1 = new JPanel(); addpanel = new JPanel(); addpanel.setMaximumSize(new Dimension(32767, 25)); addpanel.setMinimumSize(new Dimension(0, 25)); addpanel.setPreferredSize(new Dimension(50, 25)); addpanel.setLayout(new BorderLayout()); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone(); indexpos3.add(new Integer(parent.getSubItemsNr())); Item property = new Item("", 0, -1, -1, 10, 20, indexpos3); property.setSubItemVisible(false); property.setValue(""); parent.addSubItem(property); Prop prop = new Prop(parent, property); jPanel1.remove(addpanel);//from w w w.j ava2 s .c om jPanel1.add(prop); jPanel1.add(addpanel); jPanel1.revalidate(); jPanel1.repaint(); } }); addpanel.add(add, BorderLayout.EAST); addpanel.setBackground(Color.WHITE); JScrollPane jScrollPane1 = new JScrollPane(jPanel1); jPanel1.setBackground(Color.WHITE); jScrollPane1.setBackground(Color.WHITE); jScrollPane1.setBorder(null); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)), "Properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 0, 0))); setBackground(Color.WHITE); GroupLayout propLayout = new GroupLayout(this); setLayout(propLayout); propLayout.setHorizontalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); propLayout.setVerticalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); }
From source file:hpssim.grafica.HPSsim.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Lgc M DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); HPSsimWindow = new JFrame(); hpssimWindow = new JPanel(); hpssimTab = new JTabbedPane(); panelConfiguration = new JPanel(); label10 = new JLabel(); label3 = new JLabel(); ncpu = new JTextField(); label4 = new JLabel(); ngpu = new JTextField(); vSpacer1 = new JPanel(null); label11 = new JLabel(); label2 = new JLabel(); sliderSimulationTime = new JSlider(); textFieldSimTime = new JLabel(); label1 = new JLabel(); sliderJob = new JSlider(); textFieldNjob = new JLabel(); label9 = new JLabel(); textFieldQVGA = new JTextField(); label43 = new JLabel(); tex_mediaexe = new JTextField(); checkBoxEndJob = new JCheckBox(); label6 = new JLabel(); comboBoxScheduler = new JComboBox<>(); label8 = new JLabel(); textFieldTimeSlice = new JTextField(); label7 = new JLabel(); comboBoxQueue = new JComboBox<>(); vSpacer2 = new JPanel(null); label21 = new JLabel(); sliderclassRate = new JSlider(); labelclassRate = new JLabel(); label12 = new JLabel(); sliderRTJob = new JSlider(); labelRT = new JLabel(); label14 = new JLabel(); sliderOpenCl = new JSlider(); labelOPENCL = new JLabel(); checkBox_enableLog = new JCheckBox(); panelPerformance = new JPanel(); separator1 = new JSeparator(); tabbedPane1 = new JTabbedPane(); panelCPU = new JPanel(); labelCPUUsage = new JLabel(); panelCPUQueue = new JPanel(); tabbedPane2 = new JTabbedPane(); panelGPU = new JPanel(); labelGPUUsage = new JLabel(); panelGPUQueue = new JPanel(); panel2 = new JPanel(); label18 = new JLabel(); virtualTime = new JTextField(); label5 = new JLabel(); processiNelSistema = new JTextField(); label17 = new JLabel(); processiElaborazione = new JTextField(); label16 = new JLabel(); processiInCoda = new JTextField(); label15 = new JLabel(); ldavg_1 = new JTextField(); label19 = new JLabel(); ldavg_5 = new JTextField(); label20 = new JLabel(); ldavg_15 = new JTextField(); panel3 = new JPanel(); progressBar = new JProgressBar(); panelGraph = new JPanel(); graphPanel = new JPanel(); label23 = new JLabel(); label38 = new JLabel(); text_ClassRate = new JTextField(); label24 = new JLabel(); button_CostanteCodaSuMedia = new JButton(); label39 = new JLabel(); button_ClassRateCodaSuMedia = new JButton(); label25 = new JLabel(); button_CostanteTempoMedioArrivo = new JButton(); hSpacer1 = new JPanel(null); label40 = new JLabel(); button_ClassRateTempoMedioArrivo = new JButton(); label26 = new JLabel(); label41 = new JLabel(); label27 = new JLabel(); label42 = new JLabel(); label28 = new JLabel(); label33 = new JLabel(); label29 = new JLabel(); label30 = new JLabel(); label31 = new JLabel(); label32 = new JLabel(); button_CrescenteCodaSuMedia = new JButton(); label34 = new JLabel(); button_BurstCodaSuMedia = new JButton(); button_CrescenteCarico = new JButton(); label35 = new JLabel(); button_BurstTempoMedioArrivo = new JButton(); label36 = new JLabel(); label37 = new JLabel(); label22 = new JLabel(); title1 = compFactory.createTitle("HPSsim 2.0 "); button1 = new JButton(); okButton = new JButton(); button3 = new JButton(); dialog1 = new JDialog(); button2 = new JButton(); label13 = new JLabel(); erroreLabel = new JLabel(); Grafici = new JFrame(); panelGraficoFinestra = new JPanel(); //======== HPSsimWindow ======== {//from w w w .ja v a2 s .c o m HPSsimWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); HPSsimWindow.setResizable(false); Container HPSsimWindowContentPane = HPSsimWindow.getContentPane(); //======== hpssimWindow ======== { hpssimWindow.setForeground(Color.blue); // JFormDesigner evaluation mark hpssimWindow.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), hpssimWindow.getBorder())); hpssimWindow.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); hpssimWindow.setLayout(null); //======== hpssimTab ======== { //======== panelConfiguration ======== { panelConfiguration.setLayout(new TableLayout( new double[][] { { 1, 70, 70, 70, 68, 70, 70, 74 }, { 0.01, 27, 21, 26, 27, 25, 25, 25, 21, 21, TableLayout.PREFERRED, 12, TableLayout.PREFERRED, 22, 23 } })); ((TableLayout) panelConfiguration.getLayout()).setHGap(5); ((TableLayout) panelConfiguration.getLayout()).setVGap(5); //---- label10 ---- label10.setText("Hardware"); label10.setFont(new Font("Segoe UI", Font.ITALIC, 16)); panelConfiguration.add(label10, new TableLayoutConstraints(1, 1, 7, 1, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("CPU"); label3.setFont(new Font("Segoe UI", Font.PLAIN, 12)); label3.setLabelFor(ncpu); panelConfiguration.add(label3, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- ncpu ---- ncpu.setText("4"); panelConfiguration.add(ncpu, new TableLayoutConstraints(2, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("GPU"); label4.setFont(new Font("Segoe UI", Font.PLAIN, 12)); label4.setLabelFor(ngpu); panelConfiguration.add(label4, new TableLayoutConstraints(4, 2, 4, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- ngpu ---- ngpu.setText("0"); panelConfiguration.add(ngpu, new TableLayoutConstraints(5, 2, 6, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); panelConfiguration.add(vSpacer1, new TableLayoutConstraints(1, 3, 7, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label11 ---- label11.setText("Simulation"); label11.setFont(new Font("Segoe UI", Font.ITALIC, 16)); panelConfiguration.add(label11, new TableLayoutConstraints(1, 4, 7, 4, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label2 ---- label2.setText("Sim Time"); panelConfiguration.add(label2, new TableLayoutConstraints(1, 5, 1, 5, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderSimulationTime ---- sliderSimulationTime.setValue(100000); sliderSimulationTime.setMaximum(1200000); sliderSimulationTime.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderSimulationTimeStateChanged(e); } }); panelConfiguration.add(sliderSimulationTime, new TableLayoutConstraints(2, 5, 6, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- textFieldSimTime ---- textFieldSimTime.setText("100000 ms"); panelConfiguration.add(textFieldSimTime, new TableLayoutConstraints(7, 5, 7, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("Numero di job"); panelConfiguration.add(label1, new TableLayoutConstraints(1, 6, 1, 6, TableLayoutConstraints.RIGHT, TableLayoutConstraints.CENTER)); //---- sliderJob ---- sliderJob.setMaximum(20000); sliderJob.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderJobStateChanged(e); } }); panelConfiguration.add(sliderJob, new TableLayoutConstraints(2, 6, 6, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- textFieldNjob ---- textFieldNjob.setText("50"); panelConfiguration.add(textFieldNjob, new TableLayoutConstraints(7, 6, 7, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label9 ---- label9.setText("Media arrivo"); panelConfiguration.add(label9, new TableLayoutConstraints(1, 7, 1, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- textFieldQVGA ---- textFieldQVGA.setText("230"); panelConfiguration.add(textFieldQVGA, new TableLayoutConstraints(2, 7, 2, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label43 ---- label43.setText("Media exe"); panelConfiguration.add(label43, new TableLayoutConstraints(3, 7, 3, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- tex_mediaexe ---- tex_mediaexe.setText("1000"); panelConfiguration.add(tex_mediaexe, new TableLayoutConstraints(4, 7, 4, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- checkBoxEndJob ---- checkBoxEndJob.setText("End Job"); panelConfiguration.add(checkBoxEndJob, new TableLayoutConstraints(6, 7, 6, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Scheduler"); panelConfiguration.add(label6, new TableLayoutConstraints(1, 9, 1, 9, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- comboBoxScheduler ---- comboBoxScheduler.setModel(new DefaultComboBoxModel<>( new String[] { "Priority Round Robin", "Completely Fair Scheduler" })); comboBoxScheduler.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { comboBoxSchedulerActionPerformed(e); } }); panelConfiguration.add(comboBoxScheduler, new TableLayoutConstraints(2, 9, 5, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label8 ---- label8.setText("Time Slice"); panelConfiguration.add(label8, new TableLayoutConstraints(6, 9, 6, 9, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- textFieldTimeSlice ---- textFieldTimeSlice.setText("210"); panelConfiguration.add(textFieldTimeSlice, new TableLayoutConstraints(7, 9, 7, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label7 ---- label7.setText("Queue"); panelConfiguration.add(label7, new TableLayoutConstraints(1, 10, 1, 10, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- comboBoxQueue ---- comboBoxQueue.setModel(new DefaultComboBoxModel<>(new String[] { "FIFO", "Highest Priority First", "Shortest Job First", "Round Robin", "Random Queue" })); panelConfiguration.add(comboBoxQueue, new TableLayoutConstraints(2, 10, 5, 10, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); panelConfiguration.add(vSpacer2, new TableLayoutConstraints(1, 11, 7, 11, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label21 ---- label21.setText("Class Rate"); panelConfiguration.add(label21, new TableLayoutConstraints(1, 12, 1, 12, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderclassRate ---- sliderclassRate.setValue(99); sliderclassRate.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderclassRateStateChanged(e); } }); panelConfiguration.add(sliderclassRate, new TableLayoutConstraints(2, 12, 4, 12, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelclassRate ---- labelclassRate.setText("99%"); panelConfiguration.add(labelclassRate, new TableLayoutConstraints(5, 12, 5, 12, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label12 ---- label12.setText("RT Job Prob"); panelConfiguration.add(label12, new TableLayoutConstraints(1, 13, 1, 13, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderRTJob ---- sliderRTJob.setValue(45); sliderRTJob.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderRTJobStateChanged(e); } }); panelConfiguration.add(sliderRTJob, new TableLayoutConstraints(2, 13, 4, 13, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelRT ---- labelRT.setText("45%"); panelConfiguration.add(labelRT, new TableLayoutConstraints(5, 13, 5, 13, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label14 ---- label14.setText("OpenCL Job "); panelConfiguration.add(label14, new TableLayoutConstraints(1, 14, 1, 14, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderOpenCl ---- sliderOpenCl.setValue(20); sliderOpenCl.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderOpenClStateChanged(e); } }); panelConfiguration.add(sliderOpenCl, new TableLayoutConstraints(2, 14, 4, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelOPENCL ---- labelOPENCL.setText("20%"); panelConfiguration.add(labelOPENCL, new TableLayoutConstraints(5, 14, 5, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- checkBox_enableLog ---- checkBox_enableLog.setText("log"); panelConfiguration.add(checkBox_enableLog, new TableLayoutConstraints(7, 14, 7, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } hpssimTab.addTab("Configuration", panelConfiguration); //======== panelPerformance ======== { //======== tabbedPane1 ======== { //======== panelCPU ======== { panelCPU.setLayout(new BorderLayout()); //---- labelCPUUsage ---- labelCPUUsage.setText("0\\0"); labelCPUUsage.setHorizontalAlignment(SwingConstants.CENTER); panelCPU.add(labelCPUUsage, BorderLayout.SOUTH); } tabbedPane1.addTab("Usage", panelCPU); //======== panelCPUQueue ======== { panelCPUQueue.setLayout(new BorderLayout()); } tabbedPane1.addTab("Queue", panelCPUQueue); } //======== tabbedPane2 ======== { //======== panelGPU ======== { panelGPU.setLayout(new BorderLayout()); //---- labelGPUUsage ---- labelGPUUsage.setText("0\\0"); labelGPUUsage.setHorizontalAlignment(SwingConstants.CENTER); panelGPU.add(labelGPUUsage, BorderLayout.SOUTH); } tabbedPane2.addTab("Usage", panelGPU); //======== panelGPUQueue ======== { panelGPUQueue.setLayout(new BorderLayout()); } tabbedPane2.addTab("Queue", panelGPUQueue); } //======== panel2 ======== { panel2.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); //---- label18 ---- label18.setText("Virtual Time"); panel2.add(label18, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(virtualTime, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Processi nel sistema"); panel2.add(label5, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiNelSistema ---- processiNelSistema.setText("0"); panel2.add(processiNelSistema, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label17 ---- label17.setText("Processi in elaborazione"); panel2.add(label17, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiElaborazione ---- processiElaborazione.setText("0"); panel2.add(processiElaborazione, new TableLayoutConstraints(1, 3, 1, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label16 ---- label16.setText("Processi in coda"); panel2.add(label16, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiInCoda ---- processiInCoda.setText("0"); panel2.add(processiInCoda, new TableLayoutConstraints(1, 4, 1, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label15 ---- label15.setText("ldavg_1"); panel2.add(label15, new TableLayoutConstraints(0, 5, 0, 5, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_1, new TableLayoutConstraints(1, 5, 1, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label19 ---- label19.setText("ldavg_5"); panel2.add(label19, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_5, new TableLayoutConstraints(1, 6, 1, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label20 ---- label20.setText("ldavg_15"); panel2.add(label20, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_15, new TableLayoutConstraints(1, 7, 1, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } //======== panel3 ======== { panel3.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); } GroupLayout panelPerformanceLayout = new GroupLayout(panelPerformance); panelPerformance.setLayout(panelPerformanceLayout); panelPerformanceLayout.setHorizontalGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout.createSequentialGroup().addContainerGap() .addGroup(panelPerformanceLayout.createParallelGroup() .addComponent(separator1) .addGroup(panelPerformanceLayout.createSequentialGroup() .addGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(panel2, GroupLayout.PREFERRED_SIZE, 256, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(panelPerformanceLayout .createParallelGroup() .addComponent(progressBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(panel3, GroupLayout.PREFERRED_SIZE, 256, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(tabbedPane1, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE))) .addContainerGap(8, Short.MAX_VALUE))))); panelPerformanceLayout.setVerticalGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout.createSequentialGroup() .addContainerGap(15, Short.MAX_VALUE) .addGroup(panelPerformanceLayout.createParallelGroup() .addComponent(tabbedPane2, GroupLayout.DEFAULT_SIZE, 218, GroupLayout.PREFERRED_SIZE) .addComponent(tabbedPane1, GroupLayout.PREFERRED_SIZE, 218, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(separator1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addGroup(panelPerformanceLayout .createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(panel2, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE) .addGroup(panelPerformanceLayout.createSequentialGroup() .addComponent(progressBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18).addComponent(panel3, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); } hpssimTab.addTab("Performance", panelPerformance); //======== panelGraph ======== { //======== graphPanel ======== { graphPanel.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, { 27, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 25, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); //---- label23 ---- label23.setText("Carico costante"); label23.setFont(label23.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label23, new TableLayoutConstraints(0, 0, 1, 0, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label38 ---- label38.setText("Classification Rate"); label38.setFont(label38.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label38, new TableLayoutConstraints(5, 0, 6, 0, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); graphPanel.add(text_ClassRate, new TableLayoutConstraints(7, 0, 7, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label24 ---- label24.setText("Coda\\Media"); graphPanel.add(label24, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CostanteCodaSuMedia ---- button_CostanteCodaSuMedia.setText("Esegui"); button_CostanteCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CostanteCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_CostanteCodaSuMedia, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label39 ---- label39.setText("Coda\\Media"); graphPanel.add(label39, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_ClassRateCodaSuMedia ---- button_ClassRateCodaSuMedia.setText("Esegui"); button_ClassRateCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_ClassRateCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_ClassRateCodaSuMedia, new TableLayoutConstraints(7, 1, 7, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label25 ---- label25.setText("Tempo Medio Arrivo"); graphPanel.add(label25, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CostanteTempoMedioArrivo ---- button_CostanteTempoMedioArrivo.setText("Esegui"); button_CostanteTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CostanteTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_CostanteTempoMedioArrivo, new TableLayoutConstraints(2, 2, 2, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); graphPanel.add(hSpacer1, new TableLayoutConstraints(3, 0, 3, 15, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label40 ---- label40.setText("Tempo Medio Arrivo"); graphPanel.add(label40, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_ClassRateTempoMedioArrivo ---- button_ClassRateTempoMedioArrivo.setText("Esegui"); button_ClassRateTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_ClassRateTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_ClassRateTempoMedioArrivo, new TableLayoutConstraints(7, 2, 7, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label26 ---- label26.setText("Troughput"); graphPanel.add(label26, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label41 ---- label41.setText("Troughput"); graphPanel.add(label41, new TableLayoutConstraints(5, 3, 5, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label27 ---- label27.setText("Carico"); graphPanel.add(label27, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label42 ---- label42.setText("Carico"); graphPanel.add(label42, new TableLayoutConstraints(5, 4, 5, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label28 ---- label28.setText("Carico Crescente"); label28.setFont(label28.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label28, new TableLayoutConstraints(0, 5, 1, 5, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label33 ---- label33.setText("Carico Burst"); label33.setFont(label33.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label33, new TableLayoutConstraints(5, 5, 6, 5, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label29 ---- label29.setText("Coda\\Media"); graphPanel.add(label29, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label30 ---- label30.setText("Tempo Medio Arrivo"); graphPanel.add(label30, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label31 ---- label31.setText("Troughput"); graphPanel.add(label31, new TableLayoutConstraints(0, 8, 0, 8, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label32 ---- label32.setText("Carico"); graphPanel.add(label32, new TableLayoutConstraints(0, 9, 0, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CrescenteCodaSuMedia ---- button_CrescenteCodaSuMedia.setText("Esegui"); button_CrescenteCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CrescenteCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_CrescenteCodaSuMedia, new TableLayoutConstraints(2, 6, 2, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label34 ---- label34.setText("Coda\\Media"); graphPanel.add(label34, new TableLayoutConstraints(5, 6, 5, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_BurstCodaSuMedia ---- button_BurstCodaSuMedia.setText("Esegui"); button_BurstCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_BurstCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_BurstCodaSuMedia, new TableLayoutConstraints(7, 6, 7, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CrescenteCarico ---- button_CrescenteCarico.setText("Esegui"); button_CrescenteCarico.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CrescenteCaricoActionPerformed(e); } }); graphPanel.add(button_CrescenteCarico, new TableLayoutConstraints(2, 7, 2, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label35 ---- label35.setText("Tempo Medio Arrivo"); graphPanel.add(label35, new TableLayoutConstraints(5, 7, 5, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_BurstTempoMedioArrivo ---- button_BurstTempoMedioArrivo.setText("Esegui"); button_BurstTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_BurstTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_BurstTempoMedioArrivo, new TableLayoutConstraints(7, 7, 7, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label36 ---- label36.setText("Troughput"); graphPanel.add(label36, new TableLayoutConstraints(5, 8, 5, 8, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label37 ---- label37.setText("Carico"); graphPanel.add(label37, new TableLayoutConstraints(5, 9, 5, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } //---- label22 ---- label22.setText("Grafici"); label22.setFont(label22.getFont().deriveFont(label22.getFont().getStyle() | Font.BOLD, label22.getFont().getSize() + 4f)); GroupLayout panelGraphLayout = new GroupLayout(panelGraph); panelGraph.setLayout(panelGraphLayout); panelGraphLayout.setHorizontalGroup(panelGraphLayout.createParallelGroup() .addGroup(panelGraphLayout.createSequentialGroup().addGroup(panelGraphLayout .createParallelGroup() .addGroup(panelGraphLayout.createSequentialGroup().addGap(243, 243, 243) .addComponent(label22).addGap(0, 246, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.TRAILING, panelGraphLayout.createSequentialGroup().addContainerGap() .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE))) .addContainerGap())); panelGraphLayout.setVerticalGroup(panelGraphLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, panelGraphLayout.createSequentialGroup().addContainerGap().addComponent(label22) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE) .addContainerGap())); } hpssimTab.addTab("Graph", panelGraph); } hpssimWindow.add(hpssimTab); hpssimTab.setBounds(10, 40, 555, 450); //---- title1 ---- title1.setFont(title1.getFont().deriveFont(title1.getFont().getSize() + 8f)); hpssimWindow.add(title1); title1.setBounds(10, 11, 132, title1.getPreferredSize().height); //---- button1 ---- button1.setText("Stop"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); hpssimWindow.add(button1); button1.setBounds(385, 495, 74, button1.getPreferredSize().height); //---- okButton ---- okButton.setText("Start"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); } }); hpssimWindow.add(okButton); okButton.setBounds(470, 495, 74, okButton.getPreferredSize().height); //---- button3 ---- button3.setText("Resume"); button3.setVisible(false); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pauseActionPerformed(e); } }); hpssimWindow.add(button3); button3.setBounds(300, 495, 74, button3.getPreferredSize().height); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < hpssimWindow.getComponentCount(); i++) { Rectangle bounds = hpssimWindow.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = hpssimWindow.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; hpssimWindow.setMinimumSize(preferredSize); hpssimWindow.setPreferredSize(preferredSize); } } GroupLayout HPSsimWindowContentPaneLayout = new GroupLayout(HPSsimWindowContentPane); HPSsimWindowContentPane.setLayout(HPSsimWindowContentPaneLayout); HPSsimWindowContentPaneLayout.setHorizontalGroup(HPSsimWindowContentPaneLayout.createParallelGroup() .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup() .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 565, GroupLayout.PREFERRED_SIZE) .addGap(0, 4, Short.MAX_VALUE))); HPSsimWindowContentPaneLayout.setVerticalGroup(HPSsimWindowContentPaneLayout.createParallelGroup() .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup() .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 528, GroupLayout.PREFERRED_SIZE) .addGap(0, 1, Short.MAX_VALUE))); HPSsimWindow.pack(); HPSsimWindow.setLocationRelativeTo(HPSsimWindow.getOwner()); } //======== dialog1 ======== { dialog1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container dialog1ContentPane = dialog1.getContentPane(); //---- button2 ---- button2.setText("ok"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); //---- label13 ---- label13.setText("Attenzione!"); GroupLayout dialog1ContentPaneLayout = new GroupLayout(dialog1ContentPane); dialog1ContentPane.setLayout(dialog1ContentPaneLayout); dialog1ContentPaneLayout.setHorizontalGroup(dialog1ContentPaneLayout.createParallelGroup() .addGroup(dialog1ContentPaneLayout.createSequentialGroup().addContainerGap() .addGroup(dialog1ContentPaneLayout.createParallelGroup() .addComponent(label13, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.TRAILING, dialog1ContentPaneLayout.createSequentialGroup() .addGap(0, 281, Short.MAX_VALUE).addComponent(button2)) .addComponent(erroreLabel, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)) .addContainerGap())); dialog1ContentPaneLayout.setVerticalGroup(dialog1ContentPaneLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, dialog1ContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(label13, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) .addComponent(erroreLabel, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button2) .addContainerGap())); dialog1.pack(); dialog1.setLocationRelativeTo(dialog1.getOwner()); } //======== Grafici ======== { Container GraficiContentPane = Grafici.getContentPane(); //======== panelGraficoFinestra ======== { // JFormDesigner evaluation mark panelGraficoFinestra.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), panelGraficoFinestra.getBorder())); panelGraficoFinestra.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); panelGraficoFinestra.setLayout(new BorderLayout()); } GroupLayout GraficiContentPaneLayout = new GroupLayout(GraficiContentPane); GraficiContentPane.setLayout(GraficiContentPaneLayout); GraficiContentPaneLayout.setHorizontalGroup(GraficiContentPaneLayout.createParallelGroup() .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE) .addContainerGap())); GraficiContentPaneLayout.setVerticalGroup(GraficiContentPaneLayout.createParallelGroup() .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE) .addContainerGap())); Grafici.pack(); Grafici.setLocationRelativeTo(Grafici.getOwner()); } // //GEN-END:initComponents }
From source file:SuitaDetails.java
public DefPanel(String descriptions, String button, String id, int width, final int index, SuitaDetails container) {/* w ww . ja va 2 s. c om*/ this.descriptions = descriptions; this.id = id; reference = this; this.container = container; this.index = index; setBackground(new Color(255, 255, 255)); setBorder(BorderFactory.createEmptyBorder(2, 20, 2, 20)); setMaximumSize(new Dimension(32767, 30)); setMinimumSize(new Dimension(100, 30)); setPreferredSize(new Dimension(300, 30)); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); description = new JLabel(descriptions); description.setPreferredSize(new Dimension(width, 20)); description.setMinimumSize(new Dimension(width, 20)); description.setMaximumSize(new Dimension(width, 20)); add(description); filedsGap = new JPanel(); filedsGap.setBackground(new Color(255, 255, 255)); filedsGap.setMaximumSize(new Dimension(20, 20)); filedsGap.setMinimumSize(new Dimension(20, 20)); filedsGap.setPreferredSize(new Dimension(20, 20)); GroupLayout filedsGapLayout = new GroupLayout(filedsGap); filedsGap.setLayout(filedsGapLayout); filedsGapLayout.setHorizontalGroup( filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 20, Short.MAX_VALUE)); filedsGapLayout.setVerticalGroup( filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 20, Short.MAX_VALUE)); add(filedsGap); userDefinition = new JTextField(); doclistener = new DocumentListener() { public void changedUpdate(DocumentEvent e) { setParentField(userDefinition.getText(), false); } public void removeUpdate(DocumentEvent e) { setParentField(userDefinition.getText(), false); } public void insertUpdate(DocumentEvent e) { setParentField(userDefinition.getText(), false); } }; userDefinition.getDocument().addDocumentListener(doclistener); userDefinition.setText(""); userDefinition.setMaximumSize(new Dimension(300, 100)); userDefinition.setMinimumSize(new Dimension(50, 20)); userDefinition.setPreferredSize(new Dimension(100, 20)); add(userDefinition); filedsGap = new JPanel(); filedsGap.setBackground(new Color(255, 255, 255)); filedsGap.setMaximumSize(new Dimension(20, 20)); filedsGap.setMinimumSize(new Dimension(20, 20)); filedsGap.setPreferredSize(new Dimension(20, 20)); filedsGapLayout = new GroupLayout(filedsGap); filedsGap.setLayout(filedsGapLayout); filedsGapLayout.setHorizontalGroup( filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 20, Short.MAX_VALUE)); filedsGapLayout.setVerticalGroup( filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 20, Short.MAX_VALUE)); add(filedsGap); if (button.equals("UserSelect")) { final JButton database = new JButton("Database"); database.setMaximumSize(new Dimension(100, 20)); database.setMinimumSize(new Dimension(50, 20)); database.setPreferredSize(new Dimension(80, 20)); add(database); database.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { DatabaseFrame frame = new DatabaseFrame(reference); frame.executeQuery(); frame.setLocation((int) database.getLocationOnScreen().getX() - 100, (int) database.getLocationOnScreen().getY()); frame.setVisible(true); } }); } else if (button.equals("UserScript")) { JButton script = new JButton("Script"); script.setMaximumSize(new Dimension(100, 20)); script.setMinimumSize(new Dimension(50, 20)); script.setPreferredSize(new Dimension(80, 20)); add(script); script.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { // String passwd = RunnerRepository.getRPCClient().execute("sendFile", new Object[]{"/etc/passwd"}).toString(); // new MySftpBrowser(RunnerRepository.host,RunnerRepository.user,RunnerRepository.password,userDefinition,c,passwd); new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, userDefinition, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); filedsGap = new JPanel(); filedsGap.setBackground(new Color(255, 255, 255)); filedsGap.setMaximumSize(new Dimension(10, 10)); filedsGap.setMinimumSize(new Dimension(10, 10)); filedsGap.setPreferredSize(new Dimension(10, 10)); filedsGapLayout = new GroupLayout(filedsGap); filedsGap.setLayout(filedsGapLayout); filedsGapLayout.setHorizontalGroup(filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 20, Short.MAX_VALUE)); filedsGapLayout.setVerticalGroup(filedsGapLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 20, Short.MAX_VALUE)); filedsGap.setLayout(filedsGapLayout); add(filedsGap); final JButton value = new JButton("Value"); value.setMaximumSize(new Dimension(100, 20)); value.setMinimumSize(new Dimension(50, 20)); value.setPreferredSize(new Dimension(80, 20)); add(value); value.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String script = userDefinition.getText(); if (script != null && !script.equals("")) { try { String result = RunnerRepository.getRPCClient().execute("runUserScript", new Object[] { script }) + ""; JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setLocation(value.getLocationOnScreen()); JLabel l = new JLabel("Script result: " + result); f.getContentPane().add(l, BorderLayout.CENTER); f.pack(); f.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } } }); } else if (button.equals("UserText")) { JPanel database = new JPanel(); database.setBackground(Color.WHITE); database.setMaximumSize(new Dimension(100, 20)); database.setMinimumSize(new Dimension(50, 20)); database.setPreferredSize(new Dimension(80, 20)); add(database); } }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JPanel getJMemoryProfilingPanel() { if (jMemoryProfilingPanel == null) { jMemoryProfilingPanel = new JPanel(); GroupLayout jMemoryProfilingPanelLayout = new GroupLayout((JComponent) jMemoryProfilingPanel); jMemoryProfilingPanel.setLayout(jMemoryProfilingPanelLayout); jMemoryProfilingPanelLayout.setVerticalGroup(jMemoryProfilingPanelLayout.createSequentialGroup() .addContainerGap()/*from w w w. j av a2 s . co m*/ .addComponent(getJLabel7(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jMemoryProfilingPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJProfilingFromComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel8(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel9(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJProfilingToComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJAddZoneButton(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(getJScrollPane2(), GroupLayout.PREFERRED_SIZE, 254, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jMemoryProfilingPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJSortCheckBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel17(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJScrollPane6(), GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(getJDeleteZoneButton(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); jMemoryProfilingPanelLayout.linkSize(SwingConstants.VERTICAL, new Component[] { getJProfilingFromComboBox(), getJProfilingToComboBox() }); jMemoryProfilingPanelLayout.setHorizontalGroup(jMemoryProfilingPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(jMemoryProfilingPanelLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jMemoryProfilingPanelLayout.createSequentialGroup() .addComponent(getJLabel7(), GroupLayout.PREFERRED_SIZE, 608, GroupLayout.PREFERRED_SIZE) .addGap(0, 156, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, jMemoryProfilingPanelLayout .createSequentialGroup() .addGroup(jMemoryProfilingPanelLayout.createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, jMemoryProfilingPanelLayout.createSequentialGroup() .addGroup(jMemoryProfilingPanelLayout.createParallelGroup() .addComponent(getJLabel17(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.LEADING, jMemoryProfilingPanelLayout .createSequentialGroup() .addComponent(getJDeleteZoneButton(), GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addGap(46))) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJSortCheckBox(), GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jMemoryProfilingPanelLayout .createSequentialGroup() .addComponent(getJLabel8(), GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJProfilingFromComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(29))) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 74, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel9(), GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJProfilingToComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJAddZoneButton(), GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addGap(0, 275, Short.MAX_VALUE)) .addComponent(getJScrollPane2(), GroupLayout.Alignment.LEADING, 0, 764, Short.MAX_VALUE) .addComponent(getJScrollPane6(), GroupLayout.Alignment.LEADING, 0, 764, Short.MAX_VALUE)) .addContainerGap()); jMemoryProfilingPanelLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { getJProfilingFromComboBox(), getJProfilingToComboBox() }); } return jMemoryProfilingPanel; }
From source file:org.biojava.bio.view.MotifAnalyzer.java
private JPanel getStatisticsTab(int excelNum) throws IOException { JPanel panel = new JPanel(); GroupLayout panelLayout = new GroupLayout((JComponent) panel); panel.setLayout(panelLayout);/*from w w w .j a v a2 s .c om*/ panel.setPreferredSize(new java.awt.Dimension(676, 557)); Object[][] tableData = FileConverterTools.readExcel(FileNames.getStatisticsExcelFileName(excelNum)); Object columnName[] = new Object[tableData[0].length]; for (int i = 0; i < columnName.length; i++) columnName[i] = i; tableData = null; //free memory final JTable table = new JTable(); JScrollPane jScrollPane = new JScrollPane(table); table.setFont(new Font(Font.DIALOG, Font.BOLD, 15)); table.setEnabled(false); File file = new File(FileNames.getStatisticsExcelFileName(excelNum)); JTableReadTableModelTask task = new JTableReadTableModelTask(file, null, null, table); task.execute(); JButton button = new JButton("Save to Excel"); panelLayout.setVerticalGroup(panelLayout.createSequentialGroup() .addComponent(jScrollPane, GroupLayout.PREFERRED_SIZE, 485, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40)); panelLayout.setHorizontalGroup(panelLayout.createParallelGroup() .addComponent(jScrollPane, GroupLayout.Alignment.LEADING, 0, 676, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.LEADING, panelLayout.createSequentialGroup().addGap(0, 493, Short.MAX_VALUE) .addComponent(button, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40))); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(MotifAnalyzer.this.mainFrame); if (returnVal == JFileChooser.APPROVE_OPTION) { try { //File file = new File(fc.getSelectedFile().getCanonicalPath()); //JTableWriteTableModelTask task = new JTableWriteTableModelTask(file, null, null, table); //task.execute(); } catch (Exception e) { e.printStackTrace(); } } } }); return panel; }