List of usage examples for javax.swing.event ChangeListener ChangeListener
ChangeListener
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);//from ww w . j a v a 2s.c om 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:com.diversityarrays.kdxplore.curate.TrialDataEditor.java
public TrialDataEditor(CurationData cd, WindowOpener<JFrame> windowOpener, MessageLogger messageLogger, KdxploreDatabase kdxdb, IntFunction<Trait> traitProvider, SampleType[] sampleTypes) throws IOException { super(new BorderLayout()); this.traitProvider = traitProvider; this.windowOpener = windowOpener; this.curationData = cd; this.curationData.setChangeManager(changeManager); this.curationData.setKDSmartDatabase(kdxdb.getKDXploreKSmartDatabase()); inactiveTagFilterIcon = KDClientUtils.getIcon(ImageId.TAG_FILTER_24); activeTagFilterIcon = KDClientUtils.getIcon(ImageId.TAG_FILTER_ACTIVE_24); inactivePlotOrSpecimenFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_PLOT_SPEC_INACTIVE); activePlotFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_PLOT_ACTIVE); activeSpecimenFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_SPEC_ACTIVE); updatePlotSpecimenIcon();//from www.j av a 2 s.co m TraitColorProvider traitColourProvider = new TraitColorProvider(false); this.curationData.setTraitColorProvider(traitColourProvider); curationData.addCurationDataChangeListener(new CurationDataChangeListener() { @Override public void plotActivationChanged(Object source, boolean activated, List<Plot> plots) { updateRowFilter(); if (toolController != null) { toolController.plotActivationsChanged(activated, plots); } } @Override public void editedSamplesChanged(Object source, List<CurationCellId> curationCellIds) { if (toolController != null) { toolController.editedSamplesChanged(); } } }); this.selectedValueStore = new SelectedValueStore(curationData.getTrial().getTrialName()); this.messageLogger = messageLogger; smallFont = KDClientUtils.makeSmallFont(this); // undockViewAction.putValue(Action.SHORT_DESCRIPTION, "Click to undock // this view"); KDClientUtils.initAction(ImageId.HELP_24, curationHelpAction, Msg.TOOLTIP_HELP_DATA_CURATION(), false); KDClientUtils.initAction(ImageId.SAVE_24, saveChangesAction, Msg.TOOLTIP_SAVE_CHANGES(), true); KDClientUtils.initAction(ImageId.EXPORT_24, exportCuratedData, Msg.TOOLTIP_EXPORT(), true); KDClientUtils.initAction(ImageId.UNDO_24, undoAction, Msg.TOOLTIP_UNDO(), true); KDClientUtils.initAction(ImageId.REDO_24, redoAction, Msg.TOOLTIP_REDO(), true); KDClientUtils.initAction(ImageId.FIELD_VIEW_24, showFieldViewAction, Msg.TOOLTIP_FIELD_VIEW(), false); KDClientUtils.initAction(ImageId.GET_TRIALINFO_24, importCuratedData, Msg.TOOLTIP_IMPORT_DATA(), true); Function<TraitInstance, List<KdxSample>> sampleProvider = new Function<TraitInstance, List<KdxSample>>() { @Override public List<KdxSample> apply(TraitInstance ti) { return curationData.getSampleMeasurements(ti); } }; tivrByTi = VisToolUtil.buildTraitInstanceValueRetrieverMap(curationData.getTrial(), curationData.getTraitInstances(), sampleProvider); // = = = = = = = = boolean readOnly = false; // FIXME work out if the Trial can be edited or not curationTableModel = new CurationTableModel(curationData, readOnly); // See FIXME comment in CurationTableModel.isReadOnly() curationTableSelectionModel = new CurationTableSelectionModelImpl(selectedValueStore, curationTableModel); curationTableSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); curationTable = new CurationTable("CurationTable-" + (++UNIQUE_CURATION_TABLE_ID), //$NON-NLS-1$ curationTableModel, curationTableSelectionModel); curationTable.setCellSelectionEnabled(true); curationTable.setAutoCreateRowSorter(true); // = = = = = = = = this.sampleSourcesTablePanel = new SampleSourcesTablePanel(curationData, curationTableModel, handler); @SuppressWarnings("unchecked") TableRowSorter<CurationTableModel> rowSorter = (TableRowSorter<CurationTableModel>) curationTable .getRowSorter(); rowSorter.setSortsOnUpdates(true); rowSorter.addRowSorterListener(rowSorterListener); curationCellRenderer = new CurationTableCellRenderer(curationTableModel, colorProviderFactory, curationTableSelectionModel); curationTable.setDefaultRenderer(Object.class, curationCellRenderer); curationTable.setDefaultRenderer(Integer.class, curationCellRenderer); curationTable.setDefaultRenderer(String.class, curationCellRenderer); curationTable.setDefaultRenderer(CurationCellValue.class, curationCellRenderer); curationTable.setDefaultRenderer(Double.class, curationCellRenderer); curationTable.setDefaultRenderer(TraitValue.class, curationCellRenderer); // If either the rows selected change or the columns selected change // then we // need to inform the visualisation tools. curationTable.getSelectionModel().addListSelectionListener(curationTableCellSelectionListener); curationTable.getColumnModel().addColumnModelListener(curationTableCellSelectionListener); fieldLayoutView = new InterceptFieldLayoutView(); this.curationCellEditor = new CurationCellEditorImpl(curationTableModel, fieldLayoutView, curationData, refreshFieldLayoutView, kdxdb, traitProvider, sampleTypes); SuppressionInfoProvider suppressionInfoProvider = new SuppressionInfoProvider(curationData, curationTableModel, curationTable); suppressionHandler = new SuppressionHandler(curationContext, curationData, curationCellEditor, suppressionInfoProvider); loadVisualisationTools(); curationMenuProvider = new CurationMenuProvider(curationContext, curationData, messages, visualisationTools, suppressionHandler); curationMenuProvider.setSuppressionInfoProvider(suppressionInfoProvider); fieldLayoutView.addTraitInstanceSelectionListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (ItemEvent.SELECTED == e.getStateChange()) { TraitInstance traitInstance = fieldLayoutView.getActiveTraitInstance(true); if (traitInstance == null) { curationCellEditor.setCurationCellValue(null); } else { // startEdit(HowStarted.FIELD_VIEW_CHANGED_ACTIVE_TRAIT_INSTANCE); } fieldLayoutView.updateSamplesSelectedInTable(); } } }); // = = = = = = = curationData.addUnsavedChangesListener(new UnsavedChangesListener() { @Override public void unsavedChangesExist(Object source, int nChanges) { int unsavedCount = curationData.getUnsavedChangesCount(); saveChangesAction.setEnabled(unsavedCount > 0); if (unsavedCount > 0) { statusInfoLine.setMessage("Unsaved changes: " + unsavedCount); } else { statusInfoLine.setMessage("No Unsaved changes"); } } }); // curationData.addEditedSampleChangeListener(new ChangeListener() { // @Override // public void stateChanged(ChangeEvent e) { // handleEditedSampleChanges(); // } // }); saveChangesAction.setEnabled(false); changeManager.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateUndoRedoActions(); } }); undoAction.setEnabled(false); redoAction.setEnabled(false); // = = = = = = = = // TODO provide one of these for each relevant device type DeviceType deviceTypeForSamples = null; StatsData statsData = curationData.getStatsData(deviceTypeForSamples); TIStatsTableModel statsTableModel = new TIStatsTableModel2(curationData, statsData, deviceTypeForSamples); traitColourProvider.generateColorMap(statsData.getTraitInstancesWithData()); Set<Integer> instanceNumbers = statsData.getInstanceNumbers(); String nonHtmlLabel; if (instanceNumbers.size() > 1) { tAndIpanelLabel = "<HTML><i>Plot Info</i> & Trait Instances"; nonHtmlLabel = "Plot Info & Trait Instances"; } else { tAndIpanelLabel = "<HTML><i>Plot Info</i> & Traits"; nonHtmlLabel = "Plot Info & Traits"; } traitsAndInstancesPanel = new TraitsAndInstancesPanel2(curationContext, smallFont, statsTableModel, instanceNumbers.size() > 1, statsData.getInvalidRuleCount(), nonHtmlLabel, curationMenuProvider, outlierConsumer); traitsAndInstancesPanel.addTraitInstanceStatsItemListener(new ItemListener() { boolean busy; @Override public void itemStateChanged(ItemEvent e) { // NOTE: we want to process both SELECTED and DESELECTED // variants if (busy) { Shared.Log.d(TAG, "***** LOOPED in traitsAndInstancesPanel.ItemListener"); //$NON-NLS-1$ } else { Shared.Log.d(TAG, "traitsAndInstancesPanel.ItemListener BEGIN"); //$NON-NLS-1$ busy = true; try { updateViewedTraitInstances(e); // !!!!! } finally { busy = false; Shared.Log.d(TAG, "traitsAndInstancesPanel.ItemListener END\n"); //$NON-NLS-1$ } } } }); // = = = = = = = = plotCellChoicesPanel = new PlotCellChoicesPanel(curationContext, curationData, deviceTypeForSamples, tAndIpanelLabel, curationMenuProvider, colorProviderFactory); // plotCellChoicesPanel.setData( // curationData.getPlotAttributes(), // traitsAndInstancesPanel.getTraitInstancesWithData()); plotCellChoicesPanel.addPlotCellChoicesListener(new PlotCellChoicesListener() { @Override public void traitInstanceChoicesChanged(Object source, boolean choiceAdded, TraitInstance[] choice, Map<Integer, Set<TraitInstance>> traitInstancesByTraitId) { traitsAndInstancesPanel.changeTraitInstanceChoice(choiceAdded, choice); } @Override public void plotAttributeChoicesChanged(Object source, List<ValueRetriever<?>> vrList) { curationTableModel.setSelectedPlotAttributes(vrList); } }); // = = = = = = = = statsAndSamplesSplit = createStatsAndSamplesTable(traitsAndInstancesPanel.getComponent()); mainTabbedPane.addTab(TAB_SAMPLES, samplesTableIcon, statsAndSamplesSplit, Msg.TOOLTIP_SAMPLES_TABLE()); // = = = = = = = = checkForInvalidTraits(); leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createCurationCellEditorComponent(), plotCellChoicesPanel); leftSplit.setResizeWeight(0.5); // traitToDoTaskPaneContainer); // rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, // traitsAndInstancesPanel, fieldViewAndPlots); // rightSplit.setResizeWeight(0.5); // rightSplit.setOneTouchExpandable(true); leftAndRightSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplit, mainTabbedPane); leftAndRightSplit.setOneTouchExpandable(true); mainVerticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, messages, leftAndRightSplit); mainVerticalSplit.setOneTouchExpandable(true); mainVerticalSplit.setResizeWeight(0.0); add(statusInfoLine, BorderLayout.NORTH); add(mainVerticalSplit, BorderLayout.CENTER); fieldLayoutView.addCellSelectionListener(fieldViewCellSelectionListener); curationTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (SwingUtilities.isRightMouseButton(me) && 1 == me.getClickCount()) { me.consume(); displayPopupMenu(me); } } }); }
From source file:lejos.pc.charting.LogChartFrame.java
/** All the setup of components, etc. What's scary is Swing is a "lightweight" GUI framework... * @throws Exception/*from w ww. j av a2 s .c om*/ */ private void jbInit() throws Exception { this.setJMenuBar(menuBar); this.setSize(new Dimension(819, 613)); this.setMinimumSize(new Dimension(819, 613)); this.setTitle("NXT Charting Logger"); this.setEnabled(true); // enforce minimum window size this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { JFrame theFrame = (JFrame) e.getSource(); Dimension d1 = theFrame.getMinimumSize(); Dimension d2 = theFrame.getSize(); boolean enforce = false; if (theFrame.getWidth() < d1.getWidth()) { d2.setSize(d1.getWidth(), d2.getHeight()); enforce = true; } if (theFrame.getHeight() < d1.getHeight()) { d2.setSize(d2.getWidth(), d1.getHeight()); enforce = true; } if (enforce) theFrame.setSize(d2); } }); this.getContentPane().setLayout(gridBagLayout1); MenuActionListener menuItemActionListener = new MenuActionListener(); MenuEventListener menuListener = new MenuEventListener(); menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menuBar.add(menu); menuItem = new JMenuItem("Copy Chart Image", KeyEvent.VK_I); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Copy Data Log", KeyEvent.VK_D); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); menu.setActionCommand("VIEW_MENU"); menu.addMenuListener(menuListener); menuBar.add(menu); menuItem = new JMenuItem("Expand Chart", KeyEvent.VK_F); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Chart in New Window", KeyEvent.VK_N); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); menuItem = new JMenuItem("Chart controls", KeyEvent.VK_C); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Generate sample data", KeyEvent.VK_G); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("About", KeyEvent.VK_A); menuItem.addActionListener(menuItemActionListener); jTabbedPane1.setPreferredSize(new Dimension(621, 199)); jTabbedPane1.setMinimumSize(new Dimension(621, 199)); menu.add(menuItem); jButtonConnect.setText("Connect"); jButtonConnect.setBounds(new Rectangle(25, 65, 115, 25)); jButtonConnect.setToolTipText("Connect/disconnect toggle"); jButtonConnect.setMnemonic('C'); jButtonConnect.setSelected(true); jButtonConnect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButtonConnect_actionPerformed(e); } }); UIPanel.setSize(new Dimension(820, 200)); UIPanel.setLayout(null); UIPanel.setPreferredSize(new Dimension(300, 200)); UIPanel.setMinimumSize(new Dimension(300, 200)); UIPanel.setBounds(new Rectangle(0, 350, 820, 200)); UIPanel.setMaximumSize(new Dimension(300, 32767)); connectionPanel.setBounds(new Rectangle(10, 10, 175, 100)); connectionPanel.setBorder(BorderFactory.createTitledBorder("Connection")); connectionPanel.setLayout(null); connectionPanel.setFont(new Font("Tahoma", 0, 11)); jLabel1logfilename.setText("Log File:"); jLabel1logfilename.setBounds(new Rectangle(10, 125, 165, 20)); jLabel1logfilename.setHorizontalTextPosition(SwingConstants.RIGHT); jLabel1logfilename.setHorizontalAlignment(SwingConstants.LEFT); jLabel1logfilename.setToolTipText("Specify the name of your log file here"); jTextFieldNXTName.setBounds(new Rectangle(5, 40, 165, 20)); jTextFieldNXTName.setToolTipText( "The name or Address of the NXT. Leave empty and the first one found will be used."); jTextFieldNXTName.requestFocus(); jTextAreaStatus.setLineWrap(true); jTextAreaStatus.setFont(new Font("Tahoma", 0, 11)); jTextAreaStatus.setWrapStyleWord(true); jTextAreaStatus.setBackground(SystemColor.window); dataLogTextArea.setLineWrap(false); dataLogTextArea.setFont(new Font("Tahoma", 0, 11)); dataLogTextArea.setBackground(SystemColor.window); FQPathTextArea.setBounds(new Rectangle(5, 170, 185, 40)); FQPathTextArea.setLineWrap(true); FQPathTextArea.setText(getCanonicalName(new File(".", ""))); FQPathTextArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); FQPathTextArea.setRows(2); FQPathTextArea.setFont(new Font("Tahoma", 0, 9)); FQPathTextArea.setOpaque(false); FQPathTextArea.setEditable(false); selectFolderButton.setText("Folder..."); selectFolderButton.setBounds(new Rectangle(120, 125, 70, 20)); selectFolderButton.setMargin(new Insets(1, 1, 1, 1)); selectFolderButton.setFocusable(false); selectFolderButton.setMnemonic('F'); selectFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectFolderButton_actionPerformed(e); } }); // domain display limits GUI chartOptionsPanel.setLayout(null); chartDomLimitsPanel.setBounds(new Rectangle(5, 35, 180, 135)); chartDomLimitsPanel.setLayout(gridLayout1); chartDomLimitsPanel.setBorder(BorderFactory.createTitledBorder("Domain Display Limiting")); domainDisplayLimitSlider.setEnabled(false); domainDisplayLimitSlider.setMaximum(MAXDOMAIN_DATAPOINT_LIMIT); domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT); domainDisplayLimitSlider.setValue(MAXDOMAIN_DATAPOINT_LIMIT); domainDisplayLimitSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { domainDisplayLimitSlider_stateChanged(e); } }); useTimeRadioButton.setText("By Time"); useTimeRadioButton.setEnabled(false); useTimeRadioButton.setMnemonic('I'); useTimeRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { domainDisplayLimitRadioButton_actionPerformed(e); } }); useDataPointsRadioButton.setText("By Data Points"); ButtonGroup bg1 = new ButtonGroup(); bg1.add(useTimeRadioButton); bg1.add(useDataPointsRadioButton); useDataPointsRadioButton.setSelected(true); useDataPointsRadioButton.setEnabled(false); useDataPointsRadioButton.setMnemonic('P'); useDataPointsRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { domainDisplayLimitRadioButton_actionPerformed(e); } }); datasetLimitEnableCheckBox.setText("Enable"); datasetLimitEnableCheckBox.setRolloverEnabled(true); datasetLimitEnableCheckBox.setMnemonic('A'); datasetLimitEnableCheckBox.setToolTipText("Enable Domain Clipping"); datasetLimitEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { datasetLimitEnableCheckBox_actionPerformed(e); } }); domainLimitLabel.setText(String.format("%1$,d datapoints", MAXDOMAIN_DATAPOINT_LIMIT).toString()); domainLimitLabel.setEnabled(false); gridLayout1.setRows(5); gridLayout1.setColumns(1); jLabel1.setText("Chart Title:"); jLabel1.setBounds(new Rectangle(200, 10, 85, 20)); jLabel1.setPreferredSize(new Dimension(115, 14)); jLabel2.setText("Range Axis 1 Label:"); jLabel2.setBounds(new Rectangle(200, 35, 115, 20)); jLabel2.setSize(new Dimension(115, 20)); jLabel3.setText("Range Axis 2 Label:"); jLabel3.setBounds(new Rectangle(200, 60, 115, 20)); jLabel3.setSize(new Dimension(115, 20)); jLabel4.setText("Range Axis 3 Label:"); jLabel4.setBounds(new Rectangle(200, 85, 115, 20)); jLabel4.setSize(new Dimension(115, 20)); jLabel6.setText("Range Axis 4 Label:"); jLabel6.setBounds(new Rectangle(200, 110, 115, 20)); jLabel6.setSize(new Dimension(115, 20)); titleLabelChangeNotifier notifier = new titleLabelChangeNotifier(); chartTitleTextField.setBounds(new Rectangle(315, 10, 290, 20)); chartTitleTextField.getDocument().addDocumentListener(notifier); axis1LabelTextField.setBounds(new Rectangle(315, 35, 290, 20)); axis1LabelTextField.getDocument().addDocumentListener(notifier); axis2LabelTextField.setBounds(new Rectangle(315, 60, 290, 20)); axis2LabelTextField.getDocument().addDocumentListener(notifier); axis3LabelTextField.setBounds(new Rectangle(315, 85, 290, 20)); axis3LabelTextField.getDocument().addDocumentListener(notifier); axis4LabelTextField.setBounds(new Rectangle(315, 110, 290, 20)); showCommentsCheckBox.setText("Show Comment Markers"); showCommentsCheckBox.setBounds(new Rectangle(200, 140, 185, 25)); showCommentsCheckBox.setToolTipText("Show/Hide any comment markers on the chart"); showCommentsCheckBox.setRolloverEnabled(true); showCommentsCheckBox.setSelected(true); showCommentsCheckBox.setMnemonic('M'); showCommentsCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { customChartPanel.setCommentsVisible(e.getStateChange() == ItemEvent.SELECTED); } }); scrollDomainCheckBox.setText("Scroll Domain"); scrollDomainCheckBox.setBounds(new Rectangle(10, 5, 175, 20)); scrollDomainCheckBox.setSize(new Dimension(175, 25)); scrollDomainCheckBox.setSelected(true); scrollDomainCheckBox.setMnemonic('O'); scrollDomainCheckBox.setToolTipText("Checked to scroll domain as new data is received"); scrollDomainCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scrollDomainCheckBox_actionPerformed(e); } }); axis4LabelTextField.getDocument().addDocumentListener(notifier); logFileTextField.setBounds(new Rectangle(10, 145, 180, 20)); logFileTextField.setText("NXTData.txt"); logFileTextField.setPreferredSize(new Dimension(180, 20)); logFileTextField.setToolTipText("File name. Leave empty to not log to file."); statusScrollPane.setOpaque(false); dataLogScrollPane.setOpaque(false); customChartPanel.setMinimumSize(new Dimension(400, 300)); customChartPanel.setPreferredSize(new Dimension(812, 400)); jLabel5.setText("NXT Name/Address:"); jLabel5.setBounds(new Rectangle(5, 20, 160, 20)); jLabel5.setToolTipText(jTextFieldNXTName.getToolTipText()); jLabel5.setHorizontalTextPosition(SwingConstants.RIGHT); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); connectionPanel.add(jTextFieldNXTName, null); connectionPanel.add(jButtonConnect, null); connectionPanel.add(jLabel5, null); dataLogScrollPane.setViewportView(dataLogTextArea); jTabbedPane1.addTab("Data Log", dataLogScrollPane); statusScrollPane.setViewportView(jTextAreaStatus); jTabbedPane1.addTab("Status", statusScrollPane); jTabbedPane1.addTab("Chart", chartOptionsPanel); chartDomLimitsPanel.add(datasetLimitEnableCheckBox, null); chartDomLimitsPanel.add(useDataPointsRadioButton, null); chartDomLimitsPanel.add(useTimeRadioButton, null); chartDomLimitsPanel.add(domainDisplayLimitSlider, null); chartDomLimitsPanel.add(domainLimitLabel, null); chartOptionsPanel.add(scrollDomainCheckBox, null); chartOptionsPanel.add(showCommentsCheckBox, null); chartOptionsPanel.add(axis4LabelTextField, null); chartOptionsPanel.add(axis3LabelTextField, null); chartOptionsPanel.add(axis2LabelTextField, null); chartOptionsPanel.add(axis1LabelTextField, null); chartOptionsPanel.add(chartTitleTextField, null); chartOptionsPanel.add(jLabel6, null); chartOptionsPanel.add(jLabel4, null); chartOptionsPanel.add(jLabel3, null); chartOptionsPanel.add(jLabel2, null); chartOptionsPanel.add(jLabel1, null); chartOptionsPanel.add(chartDomLimitsPanel, null); tglbtnpauseplay = new JToggleButton(""); tglbtnpauseplay.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (lpm == null) return; boolean doPause = false; if (e.getStateChange() == ItemEvent.SELECTED) { doPause = true; } lpm.setReaderPaused(doPause); } }); // tglbtnpauseplay.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent e) { // System.out.println(e.toString()); // //lpm.setReaderPaused(doPause) // } // }); tglbtnpauseplay .setSelectedIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/play.png"))); tglbtnpauseplay.setIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/pause.png"))); tglbtnpauseplay.setBounds(571, 135, 30, 30); chartOptionsPanel.add(tglbtnpauseplay); jTabbedPane1.setToolTipTextAt(0, "The tab-delimited log of the data sent from the NXT"); jTabbedPane1.setToolTipTextAt(1, "Status output"); jTabbedPane1.setToolTipTextAt(2, "Chart options"); jTabbedPane1.setMnemonicAt(0, KeyEvent.VK_D); jTabbedPane1.setMnemonicAt(1, KeyEvent.VK_S); jTabbedPane1.setMnemonicAt(2, KeyEvent.VK_T); this.getContentPane().add(customChartPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); this.getContentPane().add(UIPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -107, 0)); this.getContentPane().add(jTabbedPane1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); UIPanel.add(connectionPanel, null); UIPanel.add(selectFolderButton, null); UIPanel.add(logFileTextField, null); UIPanel.add(jLabel1logfilename, null); UIPanel.add(FQPathTextArea, null); ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { String theData = null; for (;;) { theData = LogChartFrame.this.logDataQueue.poll(); if (theData == null) break; try { dataLogTextArea.getDocument().insertString(dataLogTextArea.getDocument().getLength(), theData, null); } catch (BadLocationException e) { System.out.print( "BadLocationException in datalog textarea updater thread:" + e.toString() + "\n"); } } } }; this.updateLogTextAreaTimer = new Timer(1000, taskPerformer); this.updateLogTextAreaTimer.start(); }
From source file:com.juanhg.car.CarApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblWc = new JLabel("Wc:"); lblWc.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblWcValue = new JLabel(); lblWcValue.setText("0"); lblWcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblNc = new JLabel("Ciclos:"); lblNc.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNcValue = new JLabel(); lblNcValue.setText("0"); lblNcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO3 = new JLabel("Tmax:"); lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTmaxValue = new JLabel(); lblTmaxValue.setText("0"); lblTmaxValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblV = new JLabel("V:"); lblV.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblP = new JLabel("P:"); lblP.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblH = new JLabel("Eta:"); lblH.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblEtaValue = new JLabel(); lblEtaValue.setText("0"); lblEtaValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPValue = new JLabel(); lblPValue.setText("0"); lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblF = new JLabel("F:"); lblF.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblFValue = new JLabel(); lblFValue.setText("0"); lblFValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblDist = new JLabel("Dist:"); lblDist.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblXValue = new JLabel(); lblXValue.setText("0"); lblXValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addGroup(gl_panelOutputs .createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap().addGroup(gl_panelOutputs .createParallelGroup(Alignment.LEADING) .addComponent(lblNc, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(lblWc, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblP, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblV, GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblWcValue, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) .addComponent(lblNcValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblVValue, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE) .addComponent(lblPValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblXValue, GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblFValue, GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblH) .addGap(18).addComponent(lblEtaValue, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblTmaxValue, GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)))) .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, 299, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); gl_panelOutputs.setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(20)// w w w .j av a 2 s . co m .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWc) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNc, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWcValue) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblH, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblEtaValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTmaxValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))) .addGap(11) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblFValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(lblXValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addContainerGap(30, Short.MAX_VALUE))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.TRAILING) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 300, GroupLayout.PREFERRED_SIZE) .addComponent(panelInputs, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 300, Short.MAX_VALUE) .addComponent(panel_6, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addComponent(panelLicense, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 211, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE).addGap(18) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(24))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel lblVa = new JLabel("Va"); lblVa.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblR = new JLabel("R"); lblR.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblMg = new JLabel("mg"); lblMg.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblRValue = new JLabel("8"); lblRValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMgValue = new JLabel("10"); lblMgValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVaValue = new JLabel("6"); lblVaValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVa = new JSlider(); sliderVa.setMinimum(5); sliderVa.setMaximum(8); sliderVa.setMinorTickSpacing(1); sliderVa.setValue(6); sliderVa.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderR = new JSlider(); sliderR.setMinimum(7); sliderR.setMaximum(13); sliderR.setMinorTickSpacing(1); sliderR.setValue(8); sliderR.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderMg = new JSlider(); sliderMg.setMinimum(1); sliderMg.setMaximum(20); sliderMg.setValue(10); sliderMg.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblIVcar = new JLabel("Velocidad"); lblIVcar.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVcarValue = new JLabel("120"); lblVcarValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVcar = new JSlider(); sliderVcar.setMinimum(1); sliderVcar.setMaximum(160); sliderVcar.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderVcar.setValue(120); sliderVcar.setMinorTickSpacing(1); sliderQc = new JSlider(); sliderQc.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI5Event(); } }); sliderQc.setMaximum(1500); sliderQc.setMinimum(500); sliderQc.setValue(600); sliderQc.setMinorTickSpacing(100); lblQcValue = new JLabel("600"); lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblQc = new JLabel("Qc"); lblQc.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addGap(20).addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE) .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING) .addComponent(lblMg, GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVa, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addComponent(lblIVcar, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE))) .addGap(18)) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblR, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED))) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18).addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderVa, 0, 0, Short.MAX_VALUE) .addComponent(sliderR, 0, 0, Short.MAX_VALUE) .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)))))) .addGap(48)) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent( sliderVa, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblR)) .addComponent(sliderR, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblMg)) .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addComponent(lblVa)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblIVcar, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(3))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 325, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 688, GroupLayout.PREFERRED_SIZE) .addContainerGap(94, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE) .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); JPanel panel_1 = new JPanel(); panelPlot = new JPanelGrafica(); GroupLayout gl_panel_1 = new GroupLayout(panel_1); gl_panel_1.setHorizontalGroup( gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 263, Short.MAX_VALUE) .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); gl_panel_1 .setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)); panel_1.setLayout(gl_panel_1); JPanel panel_2 = new JPanel(); panelMotor = new JPanelGrafica(); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelMotor, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)); gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_2.createSequentialGroup() .addComponent(panelMotor, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_2.setLayout(gl_panel_2); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 258, GroupLayout.PREFERRED_SIZE) .addContainerGap())); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addComponent(panel_2, 0, 0, Short.MAX_VALUE)) .addContainerGap())); panel.setLayout(gl_panel); JPanel panel_3 = new JPanel(); panel_3.setBackground(Color.WHITE); JPanel panel_4 = new JPanel(); panelCar = new JPanelGrafica(); GroupLayout gl_panel_4 = new GroupLayout(panel_4); gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING).addComponent(panelCar, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_4.createSequentialGroup() .addComponent(panelCar, GroupLayout.PREFERRED_SIZE, 252, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_4.setLayout(gl_panel_4); GroupLayout gl_panel_3 = new GroupLayout(panel_3); gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup().addContainerGap() .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE).addContainerGap())); gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup().addContainerGap() .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 252, Short.MAX_VALUE) .addContainerGap())); panel_3.setLayout(gl_panel_3); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.TRAILING, gl_panel_visualizar.createSequentialGroup().addContainerGap() .addGroup(gl_panel_visualizar.createParallelGroup(Alignment.TRAILING) .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 668, GroupLayout.PREFERRED_SIZE) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE)) .addContainerGap())); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE).addContainerGap())); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java
/** * // ww w. ja va 2 s. c o m */ private void processDB() { try { loadAndPushResourceBundle(RESOURCE_NAME); int totalColObjRecords = BasicSQLUtils.getCountAsInt("SELECT COUNT(*) FROM collectionobject"); if (totalColObjRecords > maxRequiredRecs - 1) { double ratio = 510.0 / 720.0; int width = 1024; int height = (int) ((width * ratio) + 0.5); if (iPadDBExporterObj == null) { iPadDBExporterObj = new iPadDBExporter(iPadCloud, "isite.db", width, height); } writeSimpleGlassPaneMsg(getResourceString("EXPORTING"), 24); AppContextMgr ac = AppContextMgr.getInstance(); if (ac != null) { Collection coll = AppContextMgr.getInstance().getClassObject(Collection.class); Discipline disp = AppContextMgr.getInstance().getClassObject(Discipline.class); Division div = AppContextMgr.getInstance().getClassObject(Division.class); TaxonTreeDef taxDef = disp.getTaxonTreeDef(); GeographyTreeDef geoDef = disp.getGeographyTreeDef(); LithoStratTreeDef lithoDef = disp.getLithoStratTreeDef(); GeologicTimePeriodTreeDef gtpDef = disp.getGeologicTimePeriodTreeDef(); iPadDBExporterObj.initialize(); iPadDBExporterObj.createMappings(coll.getId(), disp.getId(), div.getId(), taxDef.getId(), geoDef.getId(), lithoDef.getId(), gtpDef.getId()); exportBtn.setEnabled(false); ChangeListener cl = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { popResourceBundle(); clearSimpleGlassPaneMsg(); exportBtn.setEnabled(true); enableRemoveDatasetBtn(); } }; if (!iPadDBExporterObj.createSQLiteDatabase(null, cl)) { cl.stateChanged(new ChangeEvent(this)); } } } else { showLocalizedError("ERR_TOO_FEW", maxRequiredRecs); popResourceBundle(); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.juanhg.icecubes.IceCubesApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblO1 = new JLabel("T:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO1Value = new JLabel(); lblO1Value.setText("0"); lblO1Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("t:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO2Value = new JLabel(); lblO2Value.setText("0"); lblO2Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblV = new JLabel("V:"); lblV.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22) .addComponent(lblO1, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE) .addGap(37))) .addGroup(//from w w w . j a v a2s . c o m gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO1Value, GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE) .addGap(3)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED))) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) .addContainerGap())); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO1).addComponent(lblO1Value) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(40))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, gl_panel_control.createSequentialGroup().addContainerGap() .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(78, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Volumen"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("T"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("t"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblTValue = new JLabel("15"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lbltValue = new JLabel("-15"); lbltValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVolValue = new JLabel("20"); lblVolValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVol = new JSlider(); sliderVol.setMinimum(1); sliderVol.setMaximum(30); sliderVol.setMinorTickSpacing(1); sliderVol.setValue(20); sliderVol.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderT = new JSlider(); sliderT.setMinimum(5); sliderT.setMaximum(30); sliderT.setMinorTickSpacing(1); sliderT.setValue(15); sliderT.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); slidert = new JSlider(); slidert.setMinimum(5); slidert.setMaximum(30); slidert.setValue(15); slidert.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblI4 = new JLabel("N\u00BA de Cubitos"); lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNValue = new JLabel("1"); lblNValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderN = new JSlider(); sliderN.setMinimum(1); sliderN.setMaximum(4); sliderN.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderN.setValue(1); sliderN.setMinorTickSpacing(1); waterImage = loadImage(water); btnWater = new JButton(new ImageIcon(waterImage)); btnWater.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnWater.setEnabled(false); btnMilk.setEnabled(true); btnOrange.setEnabled(true); btnlemonade.setEnabled(true); type = WATER; fluidColor = new Color(100, 180, 255, 70); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); milkImage = loadImage(milk); btnMilk = new JButton(new ImageIcon(milkImage)); btnMilk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnWater.setEnabled(true); btnMilk.setEnabled(false); btnOrange.setEnabled(true); btnlemonade.setEnabled(true); type = MILK; fluidColor = new Color(255, 255, 255, 255); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); orangeImage = loadImage(orange); btnOrange = new JButton(new ImageIcon(orangeImage)); btnOrange.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnWater.setEnabled(true); btnMilk.setEnabled(true); btnOrange.setEnabled(false); btnlemonade.setEnabled(true); type = ORANGE; fluidColor = new Color(225, 150, 0, 220); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); lemonadeImage = loadImage(lemonade); btnlemonade = new JButton(new ImageIcon(lemonadeImage)); btnlemonade.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnWater.setEnabled(true); btnMilk.setEnabled(true); btnOrange.setEnabled(true); btnlemonade.setEnabled(false); type = LEMONADE; fluidColor = new Color(225, 225, 0, 150); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap(23, Short.MAX_VALUE) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING).addGroup(gl_panelInputs .createSequentialGroup() .addComponent(btnWater, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnOrange, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnlemonade, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addGap(8)) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING, false) .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18).addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderVol, 0, 0, Short.MAX_VALUE) .addComponent(sliderT, 0, 0, Short.MAX_VALUE) .addComponent(slidert, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18).addComponent(sliderN, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)))) .addGap(15))); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelI1).addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderVol, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelI2).addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderT, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(slidert, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(7) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(btnWater, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnMilk, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) .addComponent(btnOrange, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) .addComponent(btnlemonade, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)) .addGap(11))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup( Alignment.TRAILING, groupLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 694, GroupLayout.PREFERRED_SIZE) .addGap(156))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addGap(12) .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false) .addComponent(panel_visualizar, Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 494, Short.MAX_VALUE)) .addContainerGap(84, Short.MAX_VALUE))); JPanel panel = new JPanel(); panel.setBorder(new LineBorder(new Color(0, 0, 0))); panel.setBounds(0, 0, 368, 494); panel.setBackground(Color.WHITE); JPanel panel_1 = new JPanel(); panel_1.setBounds(1, 1, 366, 31); panel_1.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblSimulacin = new JLabel("Simulaci\u00F3n"); lblSimulacin.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_1.add(lblSimulacin); JPanel panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0))); panel_3.setBackground(Color.WHITE); panel_3.setBounds(368, 0, 326, 494); panel_visualizar.setLayout(null); panel_visualizar.add(panel); panel.setLayout(null); panel.add(panel_1); panel_7 = new JPanelGrafica(); panel_7.setBackground(Color.WHITE); panel_7.setBounds(1, 31, 366, 463); panel.add(panel_7); panelGlass = new JPanelGrafica(); panelGlass.setBackground(Color.WHITE); GroupLayout gl_panel_7 = new GroupLayout(panel_7); gl_panel_7.setHorizontalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass, GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)); gl_panel_7.setVerticalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass, GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)); panel_7.setLayout(gl_panel_7); panel_visualizar.add(panel_3); panel_3.setLayout(null); JPanel panel_4 = new JPanel(); panel_4.setBounds(1, 1, 324, 31); panel_4.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblGrficaDeEvolucin = new JLabel("Gr\u00E1fica de Evoluci\u00F3n (T frente a Q)"); lblGrficaDeEvolucin.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_4.add(lblGrficaDeEvolucin); panel_3.add(panel_4); JPanel panel7 = new JPanel(); panel7.setBorder(new LineBorder(new Color(0, 0, 0))); panel7.setBackground(Color.WHITE); panel7.setBounds(1, 31, 324, 463); panel_3.add(panel7); panel7.setLayout(null); panelChart = new JPanelGrafica(); panelChart.setBorder(new LineBorder(new Color(0, 0, 0))); panelChart.setBackground(Color.WHITE); panelChart.setBounds(0, 0, 324, 462); panel7.add(panelChart); getContentPane().setLayout(groupLayout); }
From source file:jp.massbank.spectrumsearch.SearchPage.java
/** * ?/*ww w .jav a2 s .co m*/ */ private void createWindow() { // ?? ToolTipManager ttm = ToolTipManager.sharedInstance(); ttm.setInitialDelay(50); ttm.setDismissDelay(8000); // Search? JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(1, 1, 1, 1)); mainPanel.setBorder(border); // ********************************************************************* // User File Query // ********************************************************************* DefaultTableModel fileDm = new DefaultTableModel(); fileSorter = new TableSorter(fileDm, TABLE_QUERY_FILE); queryFileTable = new JTable(fileSorter) { @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; queryFileTable.addMouseListener(new TblMouseListener()); fileSorter.setTableHeader(queryFileTable.getTableHeader()); queryFileTable.setRowSelectionAllowed(true); queryFileTable.setColumnSelectionAllowed(false); queryFileTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col = { COL_LABEL_NO, COL_LABEL_NAME, COL_LABEL_ID }; ((DefaultTableModel) fileSorter.getTableModel()).setColumnIdentifiers(col); (queryFileTable.getColumn(queryFileTable.getColumnName(0))).setPreferredWidth(44); (queryFileTable.getColumn(queryFileTable.getColumnName(1))).setPreferredWidth(LEFT_PANEL_WIDTH - 44); (queryFileTable.getColumn(queryFileTable.getColumnName(2))).setPreferredWidth(70); ListSelectionModel lm = queryFileTable.getSelectionModel(); lm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lm.addListSelectionListener(new LmFileListener()); queryFilePane = new JScrollPane(queryFileTable); queryFilePane.addMouseListener(new PaneMouseListener()); queryFilePane.setPreferredSize(new Dimension(300, 300)); // ********************************************************************* // Result // ********************************************************************* DefaultTableModel resultDm = new DefaultTableModel(); resultSorter = new TableSorter(resultDm, TABLE_RESULT); resultTable = new JTable(resultSorter) { @Override public String getToolTipText(MouseEvent me) { // super.getToolTipText(me); // ????? Point pt = me.getPoint(); int row = rowAtPoint(pt); if (row < 0) { return null; } else { int nameCol = getColumnModel().getColumnIndex(COL_LABEL_NAME); return " " + getValueAt(row, nameCol) + " "; } } @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; resultTable.addMouseListener(new TblMouseListener()); resultSorter.setTableHeader(resultTable.getTableHeader()); JPanel dbPanel = new JPanel(); dbPanel.setLayout(new BorderLayout()); resultPane = new JScrollPane(resultTable); resultPane.addMouseListener(new PaneMouseListener()); resultTable.setRowSelectionAllowed(true); resultTable.setColumnSelectionAllowed(false); resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col2 = { COL_LABEL_NAME, COL_LABEL_SCORE, COL_LABEL_HIT, COL_LABEL_ID, COL_LABEL_ION, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO }; resultDm.setColumnIdentifiers(col2); (resultTable.getColumn(resultTable.getColumnName(0))).setPreferredWidth(LEFT_PANEL_WIDTH - 180); (resultTable.getColumn(resultTable.getColumnName(1))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(2))).setPreferredWidth(20); (resultTable.getColumn(resultTable.getColumnName(3))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(4))).setPreferredWidth(20); (resultTable.getColumn(resultTable.getColumnName(5))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(6))).setPreferredWidth(50); ListSelectionModel lm2 = resultTable.getSelectionModel(); lm2.addListSelectionListener(new LmResultListener()); resultPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, 200)); dbPanel.add(resultPane, BorderLayout.CENTER); // ********************************************************************* // DB Query // ********************************************************************* DefaultTableModel dbDm = new DefaultTableModel(); querySorter = new TableSorter(dbDm, TABLE_QUERY_DB); queryDbTable = new JTable(querySorter) { @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; queryDbTable.addMouseListener(new TblMouseListener()); querySorter.setTableHeader(queryDbTable.getTableHeader()); queryDbPane = new JScrollPane(queryDbTable); queryDbPane.addMouseListener(new PaneMouseListener()); int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); queryDbPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, h)); queryDbTable.setRowSelectionAllowed(true); queryDbTable.setColumnSelectionAllowed(false); queryDbTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col3 = { COL_LABEL_ID, COL_LABEL_NAME, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO }; DefaultTableModel model = (DefaultTableModel) querySorter.getTableModel(); model.setColumnIdentifiers(col3); // queryDbTable.getColumn(queryDbTable.getColumnName(0)).setPreferredWidth(70); queryDbTable.getColumn(queryDbTable.getColumnName(1)).setPreferredWidth(LEFT_PANEL_WIDTH - 70); queryDbTable.getColumn(queryDbTable.getColumnName(2)).setPreferredWidth(70); queryDbTable.getColumn(queryDbTable.getColumnName(3)).setPreferredWidth(50); ListSelectionModel lm3 = queryDbTable.getSelectionModel(); lm3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lm3.addListSelectionListener(new LmQueryDbListener()); // ? JPanel btnPanel = new JPanel(); btnName.addActionListener(new BtnSearchNameListener()); btnAll.addActionListener(new BtnAllListener()); btnPanel.add(btnName); btnPanel.add(btnAll); parentPanel2 = new JPanel(); parentPanel2.setLayout(new BoxLayout(parentPanel2, BoxLayout.PAGE_AXIS)); parentPanel2.add(btnPanel); parentPanel2.add(queryDbPane); // ? JPanel dispModePanel = new JPanel(); isDispSelected = dispSelected.isSelected(); isDispRelated = dispRelated.isSelected(); if (isDispSelected) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else if (isDispRelated) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } Object[] retRadio = new Object[] { dispSelected, dispRelated }; for (int i = 0; i < retRadio.length; i++) { ((JRadioButton) retRadio[i]).addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (isDispSelected != dispSelected.isSelected() || isDispRelated != dispRelated.isSelected()) { isDispSelected = dispSelected.isSelected(); isDispRelated = dispRelated.isSelected(); // ?? resultTable.clearSelection(); resultPlot.clear(); compPlot.setPeaks(null, 1); resultPlot.setPeaks(null, 0); setAllPlotAreaRange(); pkgView.initResultRecInfo(); if (isDispSelected) { resultTable.getSelectionModel() .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else if (isDispRelated) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } } } }); } ButtonGroup disGroup = new ButtonGroup(); disGroup.add(dispSelected); disGroup.add(dispRelated); dispModePanel.add(lbl2); dispModePanel.add(dispSelected); dispModePanel.add(dispRelated); JPanel paramPanel = new JPanel(); paramPanel.add(etcPropertyButton); etcPropertyButton.setMargin(new Insets(0, 10, 0, 10)); etcPropertyButton.addActionListener(new ActionListener() { private ParameterSetWindow ps = null; public void actionPerformed(ActionEvent e) { // ?????????? if (!isSubWindow) { ps = new ParameterSetWindow(getParentFrame()); } else { ps.requestFocus(); } } }); JPanel optionPanel = new JPanel(); optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS)); optionPanel.add(dispModePanel); optionPanel.add(paramPanel); // PackageView????? pkgView = new PackageViewPanel(); pkgView.initAllRecInfo(); queryTabPane.addTab("DB", parentPanel2); queryTabPane.setToolTipTextAt(TAB_ORDER_DB, "Query from DB."); queryTabPane.addTab("File", queryFilePane); queryTabPane.setToolTipTextAt(TAB_ORDER_FILE, "Query from user file."); queryTabPane.setSelectedIndex(TAB_ORDER_DB); queryTabPane.setFocusable(false); queryTabPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // ? queryPlot.clear(); compPlot.clear(); resultPlot.clear(); queryPlot.setPeaks(null, 0); compPlot.setPeaks(null, 1); resultPlot.setPeaks(null, 0); // PackageView? pkgView.initAllRecInfo(); // DB Hit? if (resultTabPane.getTabCount() > 0) { resultTabPane.setSelectedIndex(0); } DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel(); dataModel.setRowCount(0); hitLabel.setText(" "); // DB?User File?????? queryTabPane.update(queryTabPane.getGraphics()); if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) { parentPanel2.update(parentPanel2.getGraphics()); updateSelectQueryTable(queryDbTable); } else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) { queryFilePane.update(queryFilePane.getGraphics()); updateSelectQueryTable(queryFileTable); } } }); // JPanel queryPanel = new JPanel(); queryPanel.setLayout(new BorderLayout()); queryPanel.add(queryTabPane, BorderLayout.CENTER); queryPanel.add(optionPanel, BorderLayout.SOUTH); queryPanel.setMinimumSize(new Dimension(0, 170)); JPanel jtp2Panel = new JPanel(); jtp2Panel.setLayout(new BorderLayout()); jtp2Panel.add(dbPanel, BorderLayout.CENTER); jtp2Panel.add(hitLabel, BorderLayout.SOUTH); jtp2Panel.setMinimumSize(new Dimension(0, 70)); Color colorGreen = new Color(0, 128, 0); hitLabel.setForeground(colorGreen); resultTabPane.addTab("Result", jtp2Panel); resultTabPane.setToolTipTextAt(TAB_RESULT_DB, "Result of DB hit."); resultTabPane.setFocusable(false); queryPlot.setMinimumSize(new Dimension(0, 100)); compPlot.setMinimumSize(new Dimension(0, 120)); resultPlot.setMinimumSize(new Dimension(0, 100)); int height = initAppletHight / 3; JSplitPane jsp_cmp2db = new JSplitPane(JSplitPane.VERTICAL_SPLIT, compPlot, resultPlot); JSplitPane jsp_qry2cmp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPlot, jsp_cmp2db); jsp_cmp2db.setDividerLocation(height); jsp_qry2cmp.setDividerLocation(height - 25); jsp_qry2cmp.setMinimumSize(new Dimension(190, 0)); viewTabPane.addTab("Compare View", jsp_qry2cmp); viewTabPane.addTab("Package View", pkgView); viewTabPane.setToolTipTextAt(TAB_VIEW_COMPARE, "Comparison of query and result spectrum."); viewTabPane.setToolTipTextAt(TAB_VIEW_PACKAGE, "Package comparison of query and result spectrum."); viewTabPane.setSelectedIndex(TAB_VIEW_COMPARE); viewTabPane.setFocusable(false); JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPanel, resultTabPane); jsp.setDividerLocation(310); jsp.setMinimumSize(new Dimension(180, 0)); jsp.setOneTouchExpandable(true); JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jsp, viewTabPane); int divideSize = (int) (initAppletWidth * 0.4); divideSize = (divideSize >= 180) ? divideSize : 180; jsp2.setDividerLocation(divideSize); jsp2.setOneTouchExpandable(true); mainPanel.add(jsp2, BorderLayout.CENTER); add(mainPanel); queryPlot.setSearchPage(this); compPlot.setSearchPage(this); resultPlot.setSearchPage(this); setJMenuBar(MenuBarGenerator.generateMenuBar(this)); }
From source file:com.juanhg.icewalker.IceWalkerApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTiempo = new JPanel(); panelTiempo.setToolTipText(""); panelTiempo.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblPhase = new JLabel("Velocidad:"); lblPhase.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPosicion = new JLabel("Posici\u00F3n:"); lblPosicion.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPositionValue = new JLabel(); lblPositionValue.setText("0"); lblPositionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs/*w w w . j a v a 2 s . c om*/ .setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblPhase, GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE).addGap(26) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addContainerGap(130, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addGap(26).addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addContainerGap(130, Short.MAX_VALUE))); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblPhase).addComponent(lblVValue)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(63))); panelOutputs.setLayout(gl_panelOutputs); panel_1 = new JPanel(); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING, false) .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelInputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) .addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addComponent(panel_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(panelTiempo, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)) .addContainerGap())))); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelTiempo, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panel_1.add(lblNewLabel); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); panel = new JPanel(); panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); label = new JLabel("Datos de la Simulaci\u00F3n"); label.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(label); btnBanana = new JButton(""); btnBanana.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnBananaEvent(); } }); bananaImage = loadImage(banana); btnBanana.setIcon(new ImageIcon(bananaImage)); btnBurger = new JButton(""); btnBurger.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnBurgerEvent(); } }); burgerImage = loadImage(burger); btnBurger.setIcon(new ImageIcon(burgerImage)); btnCookie = new JButton(""); btnCookie.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnCookieEvent(); } }); cookieImage = loadImage(cookie); btnCookie.setIcon(new ImageIcon(cookieImage)); btnCarrot = new JButton(""); carrotImage = loadImage(carrot); btnCarrot.setIcon(new ImageIcon(carrotImage)); btnCarrot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnCarrotEvent(); } }); JLabel lblNewLabel_1 = new JLabel("30 cal/100g"); JLabel lblCalg_2 = new JLabel("734 cal/100g"); lblCalg = new JLabel("90 cal/100g"); lblCalg_1 = new JLabel("433 cal/100g"); GroupLayout gl_panelTiempo = new GroupLayout(panelTiempo); gl_panelTiempo.setHorizontalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(17).addGroup(gl_panelTiempo .createParallelGroup(Alignment.LEADING, false) .addComponent(btnLaunchSimulation, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createSequentialGroup() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnBanana).addComponent(lblCalg, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblCalg_1, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(6).addComponent( btnBurger, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(18).addComponent( lblCalg_2, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE))))) .addContainerGap(24, Short.MAX_VALUE))); gl_panelTiempo.setVerticalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING).addGroup(gl_panelTiempo .createSequentialGroup() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addComponent(btnBurger, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING, false) .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.BASELINE) .addComponent(lblCalg_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblCalg_1, GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)) .addComponent(lblCalg, GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE))) .addComponent(btnBanana, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)) .addGap(30).addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addContainerGap(33, Short.MAX_VALUE))); panelTiempo.setLayout(gl_panelTiempo); JLabel LabelStrength = new JLabel("Fuerza"); LabelStrength.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelStaticFriction = new JLabel("Roz. Est\u00E1tico"); labelStaticFriction.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelDynamicFriction = new JLabel("Roz. Din\u00E1mico"); labelDynamicFriction.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblStaticFrictionValue = new JLabel("0.2"); lblStaticFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblDynamicFrictionValue = new JLabel("0.1"); lblDynamicFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblStregthValue = new JLabel("100"); lblStregthValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderStrength = new JSlider(); sliderStrength.setMinorTickSpacing(1); sliderStrength.setMinimum(1); sliderStrength.setMaximum(300); sliderStrength.setValue(100); sliderStrength.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderStrenghtEvent(); } }); sliderStaticFriction = new JSlider(); sliderStaticFriction.setMinimum(15); sliderStaticFriction.setMaximum(80); sliderStaticFriction.setMinorTickSpacing(1); sliderStaticFriction.setValue(20); sliderStaticFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderStaticFrictionEvent(); } }); sliderDynamicFriction = new JSlider(); sliderDynamicFriction.setValue(10); sliderDynamicFriction.setMaximum(15); sliderDynamicFriction.setMinimum(5); sliderDynamicFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderDynamicFrictionEvent(); } }); sliderDynamicFriction.setMinorTickSpacing(1); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelDynamicFriction, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelStrength, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelStaticFriction, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblStregthValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)) .addGap(26)) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)); gl_panelInputs .setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(8) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelStrength).addComponent(lblStregthValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelStaticFriction) .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(labelDynamicFriction) .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(75))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 432, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE) .addContainerGap())); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 598, Short.MAX_VALUE)) .addContainerGap())); GridBagLayout gbl_panel_visualizar = new GridBagLayout(); gbl_panel_visualizar.columnWidths = new int[] { 0, 0 }; gbl_panel_visualizar.rowHeights = new int[] { 0, 0, 0 }; gbl_panel_visualizar.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_panel_visualizar.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; panel_visualizar.setLayout(gbl_panel_visualizar); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPane = new GridBagConstraints(); gbc_tabbedPane.gridheight = 2; gbc_tabbedPane.fill = GridBagConstraints.BOTH; gbc_tabbedPane.gridx = 0; gbc_tabbedPane.gridy = 0; panel_visualizar.add(tabbedPane, gbc_tabbedPane); panelSimulation = new JPanelGrafica(); tabbedPane.addTab("Simulacin", null, panelSimulation, null); panelSimulation.setBackground(Color.WHITE); getContentPane().setLayout(groupLayout); }
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 ======== {/* w w w . ja va2 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:com.juanhg.cicloc.cicloCApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblPhase = new JLabel("Trabajo Ciclo:"); lblPhase.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTrabajoCValue = new JLabel(); lblTrabajoCValue.setText("0"); lblTrabajoCValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPosicion = new JLabel("Trabajo:"); lblPosicion.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTrabajoValue = new JLabel(); lblTrabajoValue.setText("0"); lblTrabajoValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); hotImage = loadImage(hot);//from ww w. ja v a 2 s . c o m coldImage = loadImage(cold); lblE = new JLabel("Rendimiento:"); lblE.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblEValue = new JLabel(); lblEValue.setText("0"); lblEValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22).addGroup(gl_panelOutputs .createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblE, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE) .addGap(26).addComponent(lblEValue, GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblPhase, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(26)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addGap(29))) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblTrabajoValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTrabajoCValue, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)))) .addGap(109)) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE) .addContainerGap(82, Short.MAX_VALUE))); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblTrabajoCValue).addComponent(lblPhase)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTrabajoValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblE, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(79))); panelOutputs.setLayout(gl_panelOutputs); panel_1 = new JPanel(); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING, false) .addComponent(panelOutputs, 0, 0, Short.MAX_VALUE) .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_6, 0, 0, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(92, Short.MAX_VALUE))); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 146, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(17))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); btnCold = new JButton(""); btnCold.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnHot.setEnabled(true); btnCold.setEnabled(false); isHot = false; lblE.setText("Eficiencia"); lblModeValue.setText("Modo Frig"); panelMode.setBackground(Color.BLUE); } }); btnCold.setIcon(new ImageIcon(coldImage)); btnCold.setEnabled(true); panelMode = new JPanel(); panelMode.setBorder(new LineBorder(new Color(0, 0, 0))); panelMode.setBackground(Color.ORANGE); btnHot = new JButton(""); btnHot.setIcon(new ImageIcon(hotImage)); btnHot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnHot.setEnabled(false); btnCold.setEnabled(true); isHot = true; lblE.setText("Rendimiento"); lblModeValue.setText("Modo Motor"); panelMode.setBackground(Color.ORANGE); } }); btnHot.setEnabled(false); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_6 .createSequentialGroup().addContainerGap() .addGroup(gl_panel_6.createParallelGroup(Alignment.LEADING, false) .addComponent(panelMode, Alignment.TRAILING, 0, 0, Short.MAX_VALUE) .addComponent(btnHot, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE)) .addGap(10) .addGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING, false) .addComponent(btnCold, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addGap(10) .addGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addComponent(panelMode, 0, 0, Short.MAX_VALUE).addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING) .addComponent(btnCold, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addComponent(btnHot, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)) .addContainerGap())); lblModeValue = new JLabel("Modo Motor"); lblModeValue.setFont(new Font("Tahoma", Font.PLAIN, 17)); GroupLayout gl_panelMode = new GroupLayout(panelMode); gl_panelMode.setHorizontalGroup(gl_panelMode.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelMode.createSequentialGroup().addContainerGap() .addComponent(lblModeValue, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); gl_panelMode .setVerticalGroup(gl_panelMode.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelMode .createSequentialGroup().addContainerGap().addComponent(lblModeValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(52))); panelMode.setLayout(gl_panelMode); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panel_1.add(lblNewLabel); JLabel LabelT1 = new JLabel("T1"); LabelT1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelT2 = new JLabel("T2"); labelT2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelVmin = new JLabel("Vm\u00EDn"); labelVmin.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblT2Value = new JLabel("300"); lblT2Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVminValue = new JLabel("2"); lblVminValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblT1Value = new JLabel("400"); lblT1Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderT1 = new JSlider(); sliderT1.setMinimum(350); sliderT1.setMaximum(450); sliderT1.setMinorTickSpacing(1); sliderT1.setValue(400); sliderT1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderT1Event(); } }); sliderT2 = new JSlider(); sliderT2.setMinimum(270); sliderT2.setMaximum(330); sliderT2.setMinorTickSpacing(1); sliderT2.setValue(300); sliderT2.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderT2Event(); } }); sliderVMin = new JSlider(); sliderVMin.setMaximum(4); sliderVMin.setMinimum(1); sliderVMin.setValue(2); sliderVMin.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderVminEvent(); } }); JLabel lblVmax = new JLabel("Vm\u00E1x"); lblVmax.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVmaxValue = new JLabel("7"); lblVmaxValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVMax = new JSlider(); sliderVMax.setMaximum(10); sliderVMax.setMinimum(6); sliderVMax.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderVmaxEvent(); } }); sliderVMax.setValue(7); sliderVMax.setMinorTickSpacing(1); JLabel labelN = new JLabel("N"); labelN.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNValue = new JLabel("10"); lblNValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderN = new JSlider(); sliderN.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderNEvent(); } }); sliderN.setValue(10); sliderN.setMinorTickSpacing(1); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGap(19).addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING, false) .addComponent(labelN, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblVmax, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelVmin, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelT2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelT1, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblVminValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderT1, 0, 0, Short.MAX_VALUE) .addComponent(sliderT2, 0, 0, Short.MAX_VALUE) .addComponent(sliderVMin, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblVmaxValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18).addComponent(sliderVMax, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED))) .addContainerGap()) .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addComponent(LabelT1).addGap(12) .addComponent(labelT2).addGap(17).addComponent(labelVmin).addGap(17) .addComponent(lblVmax, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addGap(17).addComponent(labelN, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderT1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderT2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVminValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderVMin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVmaxValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderVMax, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))) .addGap(8))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 286, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(93, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE) .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); panelPiston = new JPanelGrafica(); panelPiston.setBackground(Color.WHITE); JPanel panel_5 = new JPanel(); panel_5.setBackground(Color.WHITE); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 845, Short.MAX_VALUE) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panelPiston, GroupLayout.PREFERRED_SIZE, 355, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 183, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE).addContainerGap())); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup() .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 289, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE) .addComponent(panelPiston, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE) .addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)) .addContainerGap())); panelTermo = new JPanelGrafica(); panelTermo.setBackground(Color.WHITE); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelTermo, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelTermo, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)); panel.setLayout(gl_panel); panelPistonInterno = new JPanelGrafica(); panelPistonInterno.setBackground(Color.WHITE); GroupLayout gl_panelPiston = new GroupLayout(panelPiston); gl_panelPiston.setHorizontalGroup(gl_panelPiston.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelPiston.createSequentialGroup() .addComponent(panelPistonInterno, GroupLayout.PREFERRED_SIZE, 354, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); gl_panelPiston.setVerticalGroup(gl_panelPiston.createParallelGroup(Alignment.LEADING) .addComponent(panelPistonInterno, GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)); panelPiston.setLayout(gl_panelPiston); JPanel panelBulb = new JPanel(); panelBulb.setBackground(Color.WHITE); JPanel panelLED = new JPanel(); panelLED.setBackground(Color.WHITE); lblBulbValue = new JLabel("- Horas"); lblLEDValue = new JLabel("- Horas"); GroupLayout gl_panel_5 = new GroupLayout(panel_5); gl_panel_5.setHorizontalGroup(gl_panel_5.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_5.createSequentialGroup() .addGroup(gl_panel_5.createParallelGroup(Alignment.LEADING, false) .addComponent(panelLED, 0, 0, Short.MAX_VALUE) .addComponent(panelBulb, GroupLayout.PREFERRED_SIZE, 132, Short.MAX_VALUE)) .addGap(18).addGroup(gl_panel_5.createParallelGroup(Alignment.LEADING) .addComponent(lblBulbValue).addComponent(lblLEDValue)) .addContainerGap(87, Short.MAX_VALUE))); gl_panel_5.setVerticalGroup(gl_panel_5.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_5.createSequentialGroup() .addComponent(panelBulb, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panelLED, GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)) .addGroup(gl_panel_5.createSequentialGroup().addGap(64).addComponent(lblBulbValue) .addPreferredGap(ComponentPlacement.RELATED, 135, Short.MAX_VALUE).addComponent(lblLEDValue) .addGap(64))); LEDOnImage = loadImage(LEDOn); LEDOffImage = loadImage(LEDOff); lblLED = new JLabel(new ImageIcon(LEDOffImage)); lblLED.setBackground(Color.WHITE); GroupLayout gl_panelLED = new GroupLayout(panelLED); gl_panelLED.setHorizontalGroup(gl_panelLED.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLED.createSequentialGroup() .addComponent(lblLED, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE) .addContainerGap(33, Short.MAX_VALUE))); gl_panelLED.setVerticalGroup(gl_panelLED.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, gl_panelLED.createSequentialGroup().addContainerGap().addComponent(lblLED, GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))); panelLED.setLayout(gl_panelLED); bulbOnImage = loadImage(bulbOn); bulbOffImage = loadImage(bulbOff); lblBulb = new JLabel(new ImageIcon(bulbOffImage)); lblBulb.setBackground(Color.WHITE); GroupLayout gl_panelBulb = new GroupLayout(panelBulb); gl_panelBulb.setHorizontalGroup(gl_panelBulb.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelBulb.createSequentialGroup() .addComponent(lblBulb, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE) .addContainerGap(30, Short.MAX_VALUE))); gl_panelBulb.setVerticalGroup(gl_panelBulb.createParallelGroup(Alignment.LEADING).addComponent(lblBulb, GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)); panelBulb.setLayout(gl_panelBulb); panel_5.setLayout(gl_panel_5); JPanel panelXV = new JPanel(); panelXV.setBackground(Color.WHITE); tabbedPane.addTab("Grficas V", null, panelXV, null); JPanel panel_2 = new JPanel(); JPanel panel_3 = new JPanel(); JPanel panel_4 = new JPanel(); panelTV = new JPanelGrafica(); GroupLayout gl_panel_4 = new GroupLayout(panel_4); gl_panel_4.setHorizontalGroup( gl_panel_4.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE) .addComponent(panelTV, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)); gl_panel_4 .setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addGroup(gl_panel_4.createSequentialGroup() .addComponent(panelTV, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(306, Short.MAX_VALUE))); panel_4.setLayout(gl_panel_4); GroupLayout gl_panelXV = new GroupLayout(panelXV); gl_panelXV.setHorizontalGroup(gl_panelXV.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelXV.createSequentialGroup().addContainerGap() .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 263, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 272, GroupLayout.PREFERRED_SIZE) .addContainerGap(11, Short.MAX_VALUE))); gl_panelXV.setVerticalGroup(gl_panelXV.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelXV.createSequentialGroup().addContainerGap() .addGroup(gl_panelXV.createParallelGroup(Alignment.LEADING) .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelXV.createParallelGroup(Alignment.TRAILING, false) .addComponent(panel_3, Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(panel_2, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE))) .addContainerGap(317, Short.MAX_VALUE))); panelUV = new JPanelGrafica(); GroupLayout gl_panel_3 = new GroupLayout(panel_3); gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addComponent(panelUV, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)); gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup() .addComponent(panelUV, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(306, Short.MAX_VALUE))); panel_3.setLayout(gl_panel_3); panelPV = new JPanelGrafica(); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelPV, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)); gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelPV, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)); panel_2.setLayout(gl_panel_2); panelXV.setLayout(gl_panelXV); JPanel panelXT = new JPanel(); panelXT.setBackground(Color.WHITE); tabbedPane.addTab("Grficas T", null, panelXT, null); JPanel panel_9 = new JPanel(); panelPT = new JPanelGrafica(); GroupLayout gl_panel_9 = new GroupLayout(panel_9); gl_panel_9.setHorizontalGroup( gl_panel_9.createParallelGroup(Alignment.LEADING).addGap(0, 263, Short.MAX_VALUE) .addComponent(panelPT, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); gl_panel_9 .setVerticalGroup(gl_panel_9.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addComponent(panelPT, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)); panel_9.setLayout(gl_panel_9); JPanel panel_10 = new JPanel(); panelST = new JPanelGrafica(); GroupLayout gl_panel_10 = new GroupLayout(panel_10); gl_panel_10.setHorizontalGroup( gl_panel_10.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE) .addComponent(panelST, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)); gl_panel_10 .setVerticalGroup(gl_panel_10.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addGroup(gl_panel_10.createSequentialGroup() .addComponent(panelST, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_10.setLayout(gl_panel_10); JPanel panel_11 = new JPanel(); panelUT = new JPanelGrafica(); GroupLayout gl_panel_11 = new GroupLayout(panel_11); gl_panel_11.setHorizontalGroup( gl_panel_11.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE) .addComponent(panelUT, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)); gl_panel_11 .setVerticalGroup(gl_panel_11.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addGroup(gl_panel_11.createSequentialGroup() .addComponent(panelUT, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_11.setLayout(gl_panel_11); GroupLayout gl_panelXT = new GroupLayout(panelXT); gl_panelXT.setHorizontalGroup(gl_panelXT.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelXT.createSequentialGroup().addContainerGap() .addComponent(panel_9, GroupLayout.PREFERRED_SIZE, 263, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_11, GroupLayout.PREFERRED_SIZE, 272, GroupLayout.PREFERRED_SIZE) .addContainerGap(11, Short.MAX_VALUE))); gl_panelXT.setVerticalGroup(gl_panelXT.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelXT.createSequentialGroup().addContainerGap() .addGroup(gl_panelXT.createParallelGroup(Alignment.LEADING) .addComponent(panel_11, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelXT.createParallelGroup(Alignment.TRAILING, false) .addComponent(panel_10, Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(panel_9, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE))) .addContainerGap(317, Short.MAX_VALUE))); panelXT.setLayout(gl_panelXT); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }