List of usage examples for javax.swing JSlider JSlider
public JSlider()
From source file:eu.cassandra.training.gui.MainGUI.java
/** * Constructor of the Training Module GUI. * /*from ww w. j ava 2 s. c o m*/ * @throws UnsupportedLookAndFeelException * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException * @throws FileNotFoundException */ public MainGUI() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, FileNotFoundException { setForeground(new Color(0, 204, 51)); // Enable the closing of the frame when pressing the x on the upper corner // of the window addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Utils.cleanFiles(); System.exit(0); } }); // Cleaning temporary files from the temp folder when starting the GUI. // Utils.cleanFiles(); // Change the platforms look and feel to Nimbus LookAndFeel lnf = new javax.swing.plaf.nimbus.NimbusLookAndFeel(); UIManager.put("NimbusLookAndFeel", Color.GREEN); UIManager.setLookAndFeel(lnf); // Setting the basic attributes of the Training Module GUI setTitle("Training Module (BETA)"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 1228, 799); // Creating the menu bar and adding the menu items JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu("File"); menuBar.add(mnNewMenu); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Utils.cleanFiles(); System.exit(0); } }); mnNewMenu.add(mntmExit); JMenu mnExit = new JMenu("Help"); menuBar.add(mnExit); JMenuItem mntmManual = new JMenuItem("Manual"); mnExit.add(mntmManual); JMenuItem mntmAbout = new JMenuItem("About"); mnExit.add(mntmAbout); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); // Adding the tabbed pane to the content pane final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); GroupLayout gl_contentPane = new GroupLayout(contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(tabbedPane, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 1202, Short.MAX_VALUE)); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 736, GroupLayout.PREFERRED_SIZE) .addContainerGap(47, Short.MAX_VALUE))); // TABS // final JPanel importTab = new JPanel(); tabbedPane.addTab("Import Data", null, importTab, null); tabbedPane.setDisplayedMnemonicIndexAt(0, 0); tabbedPane.setEnabledAt(0, true); importTab.setLayout(null); final JPanel trainingTab = new JPanel(); tabbedPane.addTab("Train Activity Models", null, trainingTab, null); tabbedPane.setDisplayedMnemonicIndexAt(1, 1); tabbedPane.setEnabledAt(1, false); trainingTab.setLayout(null); final JPanel createResponseTab = new JPanel(); tabbedPane.addTab("Create Response Models", null, createResponseTab, null); tabbedPane.setEnabledAt(2, false); createResponseTab.setLayout(null); // RESPONSE MODEL TAB // final JPanel responseParametersPanel = new JPanel(); responseParametersPanel.setLayout(null); responseParametersPanel.setBorder( new TitledBorder(null, "Response Parameters", TitledBorder.LEADING, TitledBorder.TOP, null, null)); responseParametersPanel.setBounds(6, 6, 394, 271); createResponseTab.add(responseParametersPanel); final JPanel activityModelSelectionPanel = new JPanel(); activityModelSelectionPanel.setLayout(null); activityModelSelectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Activity Model Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null)); activityModelSelectionPanel.setBounds(6, 516, 394, 192); createResponseTab.add(activityModelSelectionPanel); final JPanel responsePanel = new JPanel(); responsePanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Activity Model Change Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); responsePanel.setBounds(417, 6, 770, 385); createResponseTab.add(responsePanel); responsePanel.setLayout(new BorderLayout(0, 0)); final JPanel pricingPreviewPanel = new JPanel(); pricingPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Pricing Scheme Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pricingPreviewPanel.setBounds(417, 438, 770, 259); createResponseTab.add(pricingPreviewPanel); pricingPreviewPanel.setLayout(new BorderLayout(0, 0)); final JPanel pricingSchemePanel = new JPanel(); pricingSchemePanel.setLayout(null); pricingSchemePanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Pricing Scheme Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pricingSchemePanel.setBounds(6, 274, 394, 243); createResponseTab.add(pricingSchemePanel); // ///////////////// // RESPONSE TAB // // //////////////// // RESPONSE PARAMETERS // final JLabel lblSensitivity = new JLabel("Sensitivity"); lblSensitivity.setBounds(10, 28, 78, 16); responseParametersPanel.add(lblSensitivity); final JSlider sensitivitySlider = new JSlider(); sensitivitySlider.setPaintLabels(true); sensitivitySlider.setSnapToTicks(true); sensitivitySlider.setPaintTicks(true); sensitivitySlider.setMinorTickSpacing(10); sensitivitySlider.setMajorTickSpacing(10); sensitivitySlider.setBounds(111, 28, 214, 45); responseParametersPanel.add(sensitivitySlider); final JLabel lblAwareness = new JLabel("Awareness"); lblAwareness.setBounds(10, 79, 78, 16); responseParametersPanel.add(lblAwareness); final JSlider awarenessSlider = new JSlider(); awarenessSlider.setPaintLabels(true); awarenessSlider.setPaintTicks(true); awarenessSlider.setMajorTickSpacing(10); awarenessSlider.setMinorTickSpacing(10); awarenessSlider.setSnapToTicks(true); awarenessSlider.setBounds(111, 79, 214, 45); responseParametersPanel.add(awarenessSlider); final JLabel label_7 = new JLabel("Response Model"); label_7.setBounds(10, 153, 103, 16); responseParametersPanel.add(label_7); final JRadioButton optimalCaseRadioButton = new JRadioButton("Optimal Case Scenario"); responseModelButtonGroup.add(optimalCaseRadioButton); optimalCaseRadioButton.setBounds(111, 131, 170, 18); responseParametersPanel.add(optimalCaseRadioButton); final JRadioButton normalCaseRadioButton = new JRadioButton("Normal Case Scenario"); normalCaseRadioButton.setSelected(true); responseModelButtonGroup.add(normalCaseRadioButton); normalCaseRadioButton.setBounds(111, 152, 170, 18); responseParametersPanel.add(normalCaseRadioButton); final JRadioButton discreteCaseRadioButton = new JRadioButton("Discrete Case Scenario"); discreteCaseRadioButton.setSelected(true); responseModelButtonGroup.add(discreteCaseRadioButton); discreteCaseRadioButton.setBounds(111, 173, 170, 18); responseParametersPanel.add(discreteCaseRadioButton); final JButton previewResponseButton = new JButton("Preview Response Model"); previewResponseButton.setEnabled(false); previewResponseButton.setBounds(24, 198, 157, 28); responseParametersPanel.add(previewResponseButton); final JButton createResponseButton = new JButton("Create Response Model"); createResponseButton.setEnabled(false); createResponseButton.setBounds(191, 198, 162, 28); responseParametersPanel.add(createResponseButton); final JButton createResponseAllButton = new JButton("Create Response All"); createResponseAllButton.setEnabled(false); createResponseAllButton.setBounds(111, 232, 157, 28); responseParametersPanel.add(createResponseAllButton); // SELECT ACTIVITY MODEL // final JLabel lblSelectedActivity = new JLabel("Selected Activity"); lblSelectedActivity.setBounds(10, 21, 130, 16); activityModelSelectionPanel.add(lblSelectedActivity); JScrollPane activityListScrollPane = new JScrollPane(); activityListScrollPane.setBounds(20, 39, 355, 143); activityModelSelectionPanel.add(activityListScrollPane); final JList<String> activitySelectList = new JList<String>(); activityListScrollPane.setViewportView(activitySelectList); activitySelectList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); final JButton commitButton = new JButton("Commit"); commitButton.setEnabled(false); commitButton.setBounds(151, 209, 89, 23); pricingSchemePanel.add(commitButton); JLabel lblBasicSchema = new JLabel("Basic Schema (Start-End-Value)"); lblBasicSchema.setBounds(10, 18, 182, 14); pricingSchemePanel.add(lblBasicSchema); JLabel lblNewSchemastart = new JLabel("New Schema (Start-End-Value)"); lblNewSchemastart.setBounds(197, 18, 177, 14); pricingSchemePanel.add(lblNewSchemastart); JScrollPane basicPricingSchemeScrollPane = new JScrollPane(); basicPricingSchemeScrollPane.setBounds(10, 43, 177, 161); pricingSchemePanel.add(basicPricingSchemeScrollPane); final JTextPane basicPricingSchemePane = new JTextPane(); basicPricingSchemeScrollPane.setViewportView(basicPricingSchemePane); basicPricingSchemePane.setText("00:00-23:59-0.05"); JScrollPane newPricingScrollPane = new JScrollPane(); newPricingScrollPane.setBounds(197, 43, 177, 161); pricingSchemePanel.add(newPricingScrollPane); final JTextPane newPricingSchemePane = new JTextPane(); newPricingScrollPane.setViewportView(newPricingSchemePane); JPanel buttonPanel = new JPanel(); buttonPanel.setBounds(682, 390, 265, 33); createResponseTab.add(buttonPanel); final JButton dailyResponseButton = new JButton("Daily Times"); dailyResponseButton.setEnabled(false); buttonPanel.add(dailyResponseButton); final JButton startResponseButton = new JButton("Start Time"); startResponseButton.setEnabled(false); buttonPanel.add(startResponseButton); final JPanel exportTab = new JPanel(); tabbedPane.addTab("Export Models", null, exportTab, null); tabbedPane.setEnabledAt(3, false); exportTab.setLayout(null); // PANELS // // DATA IMPORT TAB // final JPanel dataFilePanel = new JPanel(); dataFilePanel .setBorder(new TitledBorder(null, "Data File", TitledBorder.LEADING, TitledBorder.TOP, null, null)); dataFilePanel.setBounds(6, 6, 622, 284); importTab.add(dataFilePanel); dataFilePanel.setLayout(null); final JPanel disaggregationPanel = new JPanel(); disaggregationPanel.setLayout(null); disaggregationPanel.setBorder( new TitledBorder(null, "Disaggregation", TitledBorder.LEADING, TitledBorder.TOP, null, null)); disaggregationPanel.setBounds(629, 6, 567, 284); importTab.add(disaggregationPanel); final JPanel dataReviewPanel = new JPanel(); dataReviewPanel.setBorder( new TitledBorder(null, "Data Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); dataReviewPanel.setBounds(6, 293, 622, 407); importTab.add(dataReviewPanel); dataReviewPanel.setLayout(new BorderLayout(0, 0)); final JPanel consumptionModelPanel = new JPanel(); consumptionModelPanel.setBounds(629, 293, 567, 407); importTab.add(consumptionModelPanel); consumptionModelPanel.setBorder( new TitledBorder(null, "Consumption Model", TitledBorder.LEADING, TitledBorder.TOP, null, null)); consumptionModelPanel.setLayout(new BorderLayout(0, 0)); // TRAINING ACTIVITY TAB // final JPanel trainingParametersPanel = new JPanel(); trainingParametersPanel.setLayout(null); trainingParametersPanel.setBorder( new TitledBorder(null, "Training Parameters", TitledBorder.LEADING, TitledBorder.TOP, null, null)); trainingParametersPanel.setBounds(6, 6, 621, 256); trainingTab.add(trainingParametersPanel); final JPanel applianceSelectionPanel = new JPanel(); applianceSelectionPanel.setLayout(null); applianceSelectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Appliance/Activity Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null)); applianceSelectionPanel.setBounds(630, 6, 557, 256); trainingTab.add(applianceSelectionPanel); final JPanel expectedPowerPanel = new JPanel(); expectedPowerPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Expected Power Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); expectedPowerPanel.setBounds(630, 261, 557, 447); trainingTab.add(expectedPowerPanel); expectedPowerPanel.setLayout(new BorderLayout(0, 0)); contentPane.setLayout(gl_contentPane); // EXPORT TAB // JPanel modelExportPanel = new JPanel(); modelExportPanel.setLayout(null); modelExportPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Model Export Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null)); modelExportPanel.setBounds(10, 11, 596, 267); exportTab.add(modelExportPanel); final JPanel exportPreviewPanel = new JPanel(); exportPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Export Model Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); exportPreviewPanel.setBounds(10, 310, 1187, 387); exportTab.add(exportPreviewPanel); exportPreviewPanel.setLayout(new BorderLayout(0, 0)); JPanel exportButtonsPanel = new JPanel(); exportButtonsPanel.setBounds(322, 279, 536, 33); exportTab.add(exportButtonsPanel); JPanel connectionPanel = new JPanel(); connectionPanel.setLayout(null); connectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Connection Properties", TitledBorder.LEADING, TitledBorder.TOP, null, null)); connectionPanel.setBounds(606, 11, 581, 267); exportTab.add(connectionPanel); // COMPONENTS // // IMPORT TAB // // DATA IMPORT // final JLabel lblSource = new JLabel("Data Source:"); lblSource.setBounds(23, 47, 71, 16); dataFilePanel.add(lblSource); final JTextField pathField = new JTextField(); pathField.setEditable(false); pathField.setBounds(99, 41, 405, 28); dataFilePanel.add(pathField); pathField.setColumns(10); final JButton dataBrowseButton = new JButton("Browse"); dataBrowseButton.setBounds(516, 41, 87, 28); dataFilePanel.add(dataBrowseButton); final JButton resetButton = new JButton("Reset"); resetButton.setBounds(516, 81, 87, 28); dataFilePanel.add(resetButton); final JLabel lblDataMeasurementsFrom = new JLabel("Data Measurements From:"); lblDataMeasurementsFrom.setBounds(23, 90, 154, 16); dataFilePanel.add(lblDataMeasurementsFrom); final JRadioButton singleApplianceRadioButton = new JRadioButton("Single Appliance"); singleApplianceRadioButton.setEnabled(false); dataMeasurementsButtonGroup.add(singleApplianceRadioButton); singleApplianceRadioButton.setBounds(242, 110, 115, 18); dataFilePanel.add(singleApplianceRadioButton); final JRadioButton installationRadioButton = new JRadioButton("Installation"); installationRadioButton.setSelected(true); installationRadioButton.setEnabled(false); dataMeasurementsButtonGroup.add(installationRadioButton); installationRadioButton.setBounds(242, 89, 115, 18); dataFilePanel.add(installationRadioButton); final JLabel labelConsumptionModel = new JLabel("Consumption Model:"); labelConsumptionModel.setBounds(23, 179, 120, 16); dataFilePanel.add(labelConsumptionModel); final JButton importDataButton = new JButton("Import Data"); importDataButton.setEnabled(false); importDataButton.setBounds(23, 237, 126, 28); dataFilePanel.add(importDataButton); final JButton disaggregateButton = new JButton("Disaggregate"); disaggregateButton.setEnabled(false); disaggregateButton.setBounds(216, 237, 147, 28); dataFilePanel.add(disaggregateButton); final JButton createEventsButton = new JButton("Create Events Dataset"); createEventsButton.setEnabled(false); createEventsButton.setBounds(422, 237, 181, 28); dataFilePanel.add(createEventsButton); final JTextField consumptionPathField = new JTextField(); consumptionPathField.setEnabled(false); consumptionPathField.setEditable(false); consumptionPathField.setColumns(10); consumptionPathField.setBounds(99, 197, 405, 28); dataFilePanel.add(consumptionPathField); final JButton consumptionBrowseButton = new JButton("Browse"); consumptionBrowseButton.setEnabled(false); consumptionBrowseButton.setBounds(516, 197, 87, 28); dataFilePanel.add(consumptionBrowseButton); JLabel lblTypeOfMeasurements = new JLabel("Type of Measurements"); lblTypeOfMeasurements.setBounds(23, 141, 154, 16); dataFilePanel.add(lblTypeOfMeasurements); final JRadioButton activePowerRadioButton = new JRadioButton("Active Power (P)"); powerButtonGroup.add(activePowerRadioButton); activePowerRadioButton.setEnabled(false); activePowerRadioButton.setBounds(242, 140, 115, 18); dataFilePanel.add(activePowerRadioButton); final JRadioButton activeAndReactivePowerRadioButton = new JRadioButton("Active and Reactive Power (P, Q)"); activeAndReactivePowerRadioButton.setSelected(true); powerButtonGroup.add(activeAndReactivePowerRadioButton); activeAndReactivePowerRadioButton.setEnabled(false); activeAndReactivePowerRadioButton.setBounds(242, 161, 262, 18); dataFilePanel.add(activeAndReactivePowerRadioButton); // ////////////////// // DISAGGREGATION // // ///////////////// final JLabel lblAppliancesDetected = new JLabel("Detected Appliances "); lblAppliancesDetected.setBounds(18, 33, 130, 16); disaggregationPanel.add(lblAppliancesDetected); JScrollPane scrollPane_2 = new JScrollPane(); scrollPane_2.setBounds(145, 31, 396, 231); disaggregationPanel.add(scrollPane_2); final JList<String> detectedApplianceList = new JList<String>(); scrollPane_2.setViewportView(detectedApplianceList); detectedApplianceList.setEnabled(false); detectedApplianceList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); // //////////////// // TRAINING TAB // // //////////////// // TRAINING PARAMETERS // final JLabel label_1 = new JLabel("Times Per Day"); label_1.setBounds(19, 40, 103, 16); trainingParametersPanel.add(label_1); final JRadioButton timesHistogramRadioButton = new JRadioButton("Histogram"); timesHistogramRadioButton.setSelected(true); timesDailyButtonGroup.add(timesHistogramRadioButton); timesHistogramRadioButton.setBounds(160, 38, 87, 18); trainingParametersPanel.add(timesHistogramRadioButton); final JRadioButton timesNormalRadioButton = new JRadioButton("Normal Distribution"); timesNormalRadioButton.setEnabled(false); timesDailyButtonGroup.add(timesNormalRadioButton); timesNormalRadioButton.setBounds(304, 40, 137, 18); trainingParametersPanel.add(timesNormalRadioButton); JRadioButton timesGaussianRadioButton = new JRadioButton("Gaussian Mixture"); timesGaussianRadioButton.setEnabled(false); timesDailyButtonGroup.add(timesGaussianRadioButton); timesGaussianRadioButton.setBounds(478, 38, 137, 18); trainingParametersPanel.add(timesGaussianRadioButton); final JLabel label_2 = new JLabel("Start Time"); label_2.setBounds(19, 133, 103, 16); trainingParametersPanel.add(label_2); final JRadioButton startHistogramRadioButton = new JRadioButton("Histogram"); startHistogramRadioButton.setSelected(true); startTimeButtonGroup.add(startHistogramRadioButton); startHistogramRadioButton.setBounds(160, 131, 87, 18); trainingParametersPanel.add(startHistogramRadioButton); final JRadioButton startNormalRadioButton = new JRadioButton("Normal Distribution"); // startNormalRadioButton.setEnabled(false); startTimeButtonGroup.add(startNormalRadioButton); startNormalRadioButton.setBounds(304, 133, 137, 18); trainingParametersPanel.add(startNormalRadioButton); final JRadioButton startGaussianRadioButton = new JRadioButton("Gaussian Mixture"); startGaussianRadioButton.setSelected(true); startTimeButtonGroup.add(startGaussianRadioButton); startGaussianRadioButton.setBounds(478, 131, 137, 18); trainingParametersPanel.add(startGaussianRadioButton); final JLabel label_3 = new JLabel("Duration"); label_3.setBounds(19, 86, 103, 16); trainingParametersPanel.add(label_3); final JRadioButton durationHistogramRadioButton = new JRadioButton("Histogram"); durationHistogramRadioButton.setSelected(true); durationButtonGroup.add(durationHistogramRadioButton); durationHistogramRadioButton.setBounds(160, 84, 87, 18); trainingParametersPanel.add(durationHistogramRadioButton); final JRadioButton durationNormalRadioButton = new JRadioButton("Normal Distribution"); durationNormalRadioButton.setSelected(true); durationButtonGroup.add(durationNormalRadioButton); durationNormalRadioButton.setBounds(304, 86, 137, 18); trainingParametersPanel.add(durationNormalRadioButton); final JRadioButton durationGaussianRadioButton = new JRadioButton("Gaussian Mixture"); durationButtonGroup.add(durationGaussianRadioButton); durationGaussianRadioButton.setBounds(478, 84, 137, 18); trainingParametersPanel.add(durationGaussianRadioButton); final JButton trainingButton = new JButton("Train"); trainingButton.setBounds(125, 194, 115, 28); trainingParametersPanel.add(trainingButton); final JButton trainAllButton = new JButton("Train All"); trainAllButton.setBounds(366, 194, 115, 28); trainingParametersPanel.add(trainAllButton); // APPLIANCE SELECTION // final JLabel label_4 = new JLabel("Selected Appliance"); label_4.setBounds(18, 33, 130, 16); applianceSelectionPanel.add(label_4); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(128, 29, 419, 216); applianceSelectionPanel.add(scrollPane_1); final JList<String> selectedApplianceList = new JList<String>(); scrollPane_1.setViewportView(selectedApplianceList); selectedApplianceList.setEnabled(false); selectedApplianceList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); // DISTRIBUTION SELECTION // JPanel distributionSelectionPanel = new JPanel(); distributionSelectionPanel.setBounds(80, 261, 482, 33); trainingTab.add(distributionSelectionPanel); final JButton dailyTimesButton = new JButton("Daily Times"); dailyTimesButton.setEnabled(false); distributionSelectionPanel.add(dailyTimesButton); final JButton durationButton = new JButton("Duration"); durationButton.setEnabled(false); distributionSelectionPanel.add(durationButton); final JButton startTimeButton = new JButton("Start Time"); startTimeButton.setEnabled(false); distributionSelectionPanel.add(startTimeButton); final JButton startTimeBinnedButton = new JButton("Start Time Binned"); startTimeBinnedButton.setEnabled(false); distributionSelectionPanel.add(startTimeBinnedButton); final JPanel distributionPreviewPanel = new JPanel(); distributionPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Distribution Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); distributionPreviewPanel.setBounds(6, 299, 621, 409); trainingTab.add(distributionPreviewPanel); distributionPreviewPanel.setLayout(new BorderLayout(0, 0)); // ////////////////// // EXPORT TAB /////// // ///////////////// JLabel exportModelLabel = new JLabel("Select Model"); exportModelLabel.setBounds(10, 34, 151, 16); modelExportPanel.add(exportModelLabel); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(83, 32, 503, 212); modelExportPanel.add(scrollPane); final JList<String> exportModelList = new JList<String>(); scrollPane.setViewportView(exportModelList); exportModelList.setEnabled(false); exportModelList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); // EXPORT TAB // final JButton exportDailyButton = new JButton("Daily Times"); exportDailyButton.setEnabled(false); exportButtonsPanel.add(exportDailyButton); final JButton exportDurationButton = new JButton("Duration"); exportDurationButton.setEnabled(false); exportButtonsPanel.add(exportDurationButton); final JButton exportStartButton = new JButton("Start Time"); exportStartButton.setEnabled(false); exportButtonsPanel.add(exportStartButton); final JButton exportStartBinnedButton = new JButton("Start Time Binned"); exportStartBinnedButton.setEnabled(false); exportButtonsPanel.add(exportStartBinnedButton); final JButton exportExpectedPowerButton = new JButton("Expected Power"); exportExpectedPowerButton.setEnabled(false); exportButtonsPanel.add(exportExpectedPowerButton); JLabel usernameLabel = new JLabel("Username:"); usernameLabel.setBounds(46, 27, 71, 16); connectionPanel.add(usernameLabel); final JTextField usernameTextField; usernameTextField = new JTextField(); usernameTextField.setText("user"); usernameTextField.setColumns(10); usernameTextField.setBounds(122, 21, 405, 28); connectionPanel.add(usernameTextField); final JButton exportButton = new JButton("Export Entity"); exportButton.setEnabled(false); exportButton.setBounds(46, 178, 147, 28); connectionPanel.add(exportButton); final JButton exportAllBaseButton = new JButton("Export All Base"); exportAllBaseButton.setEnabled(false); exportAllBaseButton.setBounds(203, 178, 177, 28); connectionPanel.add(exportAllBaseButton); final JButton exportAllResponseButton = new JButton("Export All Response"); exportAllResponseButton.setEnabled(false); exportAllResponseButton.setBounds(390, 178, 181, 28); connectionPanel.add(exportAllResponseButton); JLabel passwordLabel = new JLabel("Password:"); passwordLabel.setBounds(46, 62, 71, 16); connectionPanel.add(passwordLabel); JLabel UrlLabel = new JLabel("URL:"); UrlLabel.setBounds(46, 105, 71, 16); connectionPanel.add(UrlLabel); final JTextField urlTextField; urlTextField = new JTextField(); urlTextField.setText("https://160.40.50.233:8443/cassandra/api"); urlTextField.setColumns(10); urlTextField.setBounds(122, 99, 405, 28); connectionPanel.add(urlTextField); final JButton connectButton = new JButton("Connect"); connectButton.setEnabled(false); connectButton.setBounds(217, 138, 147, 28); connectionPanel.add(connectButton); final JPasswordField passwordField; passwordField = new JPasswordField(); passwordField.setBounds(122, 60, 405, 28); connectionPanel.add(passwordField); final JTextField householdNameTextField; householdNameTextField = new JTextField(); householdNameTextField.setEnabled(false); householdNameTextField.setBounds(166, 225, 405, 31); connectionPanel.add(householdNameTextField); householdNameTextField.setColumns(10); final JLabel householdNameLabel = new JLabel("Export Household Name:"); householdNameLabel.setBounds(24, 233, 147, 14); connectionPanel.add(householdNameLabel); JButton btnOpenPlatform = new JButton("Open Platform"); btnOpenPlatform.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop() .browse(new URL("https://cassandra.iti.gr:8443/cassandra/app.html").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnOpenPlatform.setBounds(401, 138, 147, 28); connectionPanel.add(btnOpenPlatform); // ////////////////// // ACTIONS /////// // ///////////////// // IMPORT TAB // // DATA IMPORT //// dataBrowseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the browse button to * input the data file on the Data File panel of the Import Data tab. * */ @Override public void actionPerformed(ActionEvent e) { // Opens the browse panel to find the data set file JFileChooser fc = new JFileChooser("./"); // Adds a filter to the type of files acceptable for selection fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new MyFilter2()); int returnVal = fc.showOpenDialog(contentPane); // After choosing the file some of the options in the Data File panel // are unlocked if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); pathField.setText(file.getAbsolutePath()); importDataButton.setEnabled(true); activePowerRadioButton.setEnabled(true); activeAndReactivePowerRadioButton.setEnabled(true); installationRadioButton.setEnabled(true); singleApplianceRadioButton.setEnabled(true); } } }); consumptionBrowseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the browse button to * input the consumption model file on the Data File panel of the Import * Data tab. * */ @Override public void actionPerformed(ActionEvent e) { // Opens the browse panel to find the consumption model file JFileChooser fc = new JFileChooser("./"); // Adds a filter to the type of files acceptable for selection fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new MyFilter()); int returnVal = fc.showOpenDialog(contentPane); // After choosing the file some of the options in the Data File panel // are unlocked if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); consumptionPathField.setText(file.getAbsolutePath()); createEventsButton.setEnabled(true); } } }); resetButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the reset button * on the Data File panel of the Import Data tab. All the imported and * created entities are removed and the Training Module goes back to its * initial state. * */ @Override public void actionPerformed(ActionEvent e) { // Cleaning the Import Data tab components pathField.setText(""); consumptionPathField.setText(""); importDataButton.setEnabled(false); disaggregateButton.setEnabled(false); createEventsButton.setEnabled(false); installation = new Installation(); dataBrowseButton.setEnabled(true); consumptionBrowseButton.setEnabled(false); installationRadioButton.setEnabled(false); installationRadioButton.setSelected(true); singleApplianceRadioButton.setEnabled(false); activePowerRadioButton.setEnabled(false); activeAndReactivePowerRadioButton.setEnabled(false); activeAndReactivePowerRadioButton.setSelected(true); dataReviewPanel.removeAll(); dataReviewPanel.updateUI(); consumptionModelPanel.removeAll(); consumptionModelPanel.updateUI(); detectedApplianceList.setSelectedIndex(-1); detectedAppliances.clear(); detectedApplianceList.setListData(new String[0]); detectedApplianceList.repaint(); // Cleaning the Training Activity Models tab components distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); expectedPowerPanel.removeAll(); expectedPowerPanel.updateUI(); selectedApplianceList.setSelectedIndex(-1); selectedAppliances.clear(); selectedApplianceList.setListData(new String[0]); selectedApplianceList.repaint(); timesHistogramRadioButton.setSelected(true); durationNormalRadioButton.setSelected(true); startGaussianRadioButton.setSelected(true); // Cleaning the Create Response Models tab components sensitivitySlider.setValue(50); awarenessSlider.setValue(50); normalCaseRadioButton.setSelected(true); previewResponseButton.setEnabled(false); createResponseButton.setEnabled(false); createResponseAllButton.setEnabled(false); pricingPreviewPanel.removeAll(); pricingPreviewPanel.updateUI(); responsePanel.removeAll(); responsePanel.updateUI(); activitySelectList.setSelectedIndex(-1); activityModels.clear(); activitySelectList.setListData(new String[0]); activitySelectList.repaint(); basicPricingSchemePane.setText("00:00-23:59-0.05"); newPricingSchemePane.setText(""); commitButton.setEnabled(false); dailyResponseButton.setEnabled(false); startResponseButton.setEnabled(false); // Cleaning the Export Models tab components exportModelList.setSelectedIndex(-1); exportModels.clear(); exportModelList.setListData(new String[0]); exportModelList.repaint(); exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); exportDailyButton.setEnabled(false); exportDurationButton.setEnabled(false); exportStartButton.setEnabled(false); exportStartBinnedButton.setEnabled(false); exportExpectedPowerButton.setEnabled(false); exportButton.setEnabled(false); exportAllBaseButton.setEnabled(false); exportAllResponseButton.setEnabled(false); householdNameTextField.setEnabled(false); // Disabling the necessary tabs tabbedPane.setEnabledAt(1, false); tabbedPane.setEnabledAt(2, false); tabbedPane.setEnabledAt(3, false); // Clearing the arrayList in need tempAppliances.clear(); tempActivities.clear(); // Removing temporary files Utils.cleanFiles(); trained = false; } }); singleApplianceRadioButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Single Appliance * radio button on the Data File panel of the Import Data tab. */ @Override public void actionPerformed(ActionEvent e) { consumptionPathField.setEnabled(false); consumptionBrowseButton.setEnabled(false); consumptionPathField.setText(""); } }); installationRadioButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Installation * radio button on the Data File panel of the Import Data tab. */ @Override public void actionPerformed(ActionEvent e) { consumptionPathField.setEnabled(false); consumptionBrowseButton.setEnabled(false); consumptionPathField.setText(""); } }); importDataButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Import Data * button on the Data File panel of the Import Data tab. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Change the state of some components installationRadioButton.setEnabled(false); singleApplianceRadioButton.setEnabled(false); importDataButton.setEnabled(false); dataBrowseButton.setEnabled(false); activePowerRadioButton.setEnabled(false); activeAndReactivePowerRadioButton.setEnabled(false); // Check if both active and reactive activeOnly data set are available boolean power = activePowerRadioButton.isSelected(); int parse = -1; // Parsing the measurements file try { parse = Utils.parseMeasurementsFile(pathField.getText(), power); } catch (IOException e2) { e2.printStackTrace(); } // If everything is OK if (parse == -1) { try { // Creating new installation installation = new Installation(pathField.getText(), power); } catch (IOException e2) { e2.printStackTrace(); } // Show the measurements in the preview chart ChartPanel chartPanel = null; try { chartPanel = installation.measurementsChart(); } catch (IOException e1) { e1.printStackTrace(); } dataReviewPanel.add(chartPanel, BorderLayout.CENTER); dataReviewPanel.validate(); disaggregateButton.setEnabled(false); createEventsButton.setEnabled(false); // Enable the appropriate buttons given source of measurements if (installationRadioButton.isSelected()) { disaggregateButton.setEnabled(true); } else if (singleApplianceRadioButton.isSelected()) { consumptionPathField.setEnabled(true); consumptionBrowseButton.setEnabled(true); } // Add installation to the export models list exportModels.addElement(installation.toString()); exportModels.addElement(installation.getPerson().getName()); householdNameTextField.setText(installation.getName()); // Enable Export Models tab exportModelList.setEnabled(true); exportModelList.setModel(exportModels); tabbedPane.setEnabledAt(3, true); } // In case of an error during the measurement parsing show the line of // error and reset settings. else { JFrame error = new JFrame(); JOptionPane.showMessageDialog(error, "Parsing measurements file failed. The problem seems to be in line " + parse + ".Check the selected buttons and the file provided and try again.", "Inane error", JOptionPane.ERROR_MESSAGE); resetButton.doClick(); } } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); disaggregateButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Disaggregate * button on the Data File panel of the Import Data tab in order to * automatically analyse the data set and extract the appliances and * activities within. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Get auxiliary files containing appliances and activities which are // the output of the disaggregation process. String filename = pathField.getText(); File file = new File(filename); String folder = file.getParent() + "/"; String fileNameWithExtension = file.getName(); String fileName = file.getName().substring(0, file.getName().length() - 4); filename = pathField.getText().substring(0, pathField.getText().length() - 4); File appliancesFile = new File(Constants.resultFolder + fileName + "ApplianceList.csv"); File activitiesFile = new File(Constants.resultFolder + fileName + "ActivityList.csv"); if ((Constants.USE_FILES == false) || (!appliancesFile.exists() && !activitiesFile.exists())) { try { System.out.println("IN!!!"); Disaggregate dis = new Disaggregate(folder, fileNameWithExtension); appliancesFile = new File(Constants.resultFolder + fileName + "ApplianceList.csv"); activitiesFile = new File(Constants.resultFolder + fileName + "ActivityList.csv"); } catch (Exception e2) { System.out.println("Missing File"); e2.printStackTrace(); } } // If these exist, disaggregation was successful and the procedure can // continue if (appliancesFile.exists() && activitiesFile.exists()) { // Read appliance file and start appliance parsing Scanner input = null; try { input = new Scanner(appliancesFile); } catch (FileNotFoundException e1) { e1.printStackTrace(); } String nextLine; String[] line; while (input.hasNext()) { nextLine = input.nextLine(); line = nextLine.split(","); String name = line[1] + " " + line[0]; // String activity = line[1]; String activity = name; String[] temp = line[0].split(" "); String type = ""; if (temp.length == 1) type = temp[0]; else { for (int i = 0; i < temp.length - 1; i++) type += temp[i] + " "; type = type.trim(); } boolean refFlag = activity.contains("Refrigeration"); boolean wmFlag = name.contains("Washing"); double p = 0, q = 0; int distance = 0, duration = 0; if (refFlag) { p = Double.parseDouble(line[2]); q = Double.parseDouble(line[3]); duration = Integer.parseInt(line[4]); distance = Integer.parseInt(line[5]); // For each appliance found in the file, an temporary Appliance // Entity is created. tempAppliances.add(new ApplianceTemp(name, installation.getName(), type, activity, p, q, duration, distance)); } else if (wmFlag) { double[] pValues = new double[line.length / 2 - 1]; double[] qValues = new double[line.length / 2 - 1]; // For each appliance found in the file, an temporary Appliance // Entity is created. for (int i = 0; i < pValues.length; i++) { pValues[i] = Double.parseDouble(line[2 + 2 * i]); qValues[i] = Double.parseDouble(line[3 + 2 * i]); } tempAppliances.add(new ApplianceTemp(name, installation.getName(), type, activity, pValues, qValues)); } else { p = Double.parseDouble(line[2]); q = Double.parseDouble(line[3]); // For each appliance found in the file, an temporary Appliance // Entity is created. tempAppliances .add(new ApplianceTemp(name, installation.getName(), type, activity, p, q)); } } System.out.println("Appliances:" + tempAppliances.size()); input.close(); // Read activity file and start activity parsing try { input = new Scanner(activitiesFile); } catch (FileNotFoundException e1) { System.out.println("Problem with activity file."); e1.printStackTrace(); } while (input.hasNext()) { nextLine = input.nextLine(); line = nextLine.split(","); // System.out.println(Arrays.toString(line)); // String name = line[0]; // String activity = line[1]; String activity = line[1] + " " + line[0]; String type = line[1]; int start = Integer.parseInt(line[2]); int end = Integer.parseInt(line[3]); // Search for existing activity int activityIndex = findActivity(activity); // if not found, create a new one if (activityIndex == -1) { // System.out.println("In!"); ActivityTemp newActivity = new ActivityTemp(activity, type); newActivity.addEvent(start, end); tempActivities.add(newActivity); // System.out.println(tempActivities.toString()); } // else add data to the found activity else tempActivities.get(activityIndex).addEvent(start, end); } // This is hard copied for now ArrayList<ActivityTemp> activities = findAllActivity("Refrigeration"); for (ActivityTemp activityTemp : activities) { tempActivities.remove(activityTemp); System.out.println("Refrigeration Removed"); } int index = findActivity("Standby"); if (index != -1) { tempActivities.remove(index); System.out.println("Standby Consumption Removed"); } // TODO Add these lines in case we want to remove activities with // small sampling number // System.out.println(tempActivities.size()); // for (int i = tempActivities.size() - 1; i >= 0; i--) // if (tempActivities.get(i).getEvents().size() < threshold) // tempActivities.remove(i); // Create an event file for each activity, in order to be able to // use // it for training the behaviour models if asked from the user for (int i = 0; i < tempActivities.size(); i++) { // tempActivities.get(i).status(); try { tempActivities.get(i).createEventFile(); } catch (IOException e1) { System.out.println("Problem with creating events file."); e1.printStackTrace(); } } input.close(); // Add each found appliance (after converting temporary appliance to // normal appliance) in the installation Entity, to the detected // appliance and export models list for (ApplianceTemp temp : tempAppliances) { Appliance tempAppliance = temp.toAppliance(); installation.addAppliance(tempAppliance); detectedAppliances.addElement(tempAppliance.toString()); exportModels.addElement(tempAppliance.toString()); } // Add appliances corresponding to each activity, remove activities // without appliances and add activities to the selected activities // list. for (int i = tempActivities.size() - 1; i >= 0; i--) { tempActivities.get(i).setAppliances(findAppliances(tempActivities.get(i))); if (tempActivities.get(i).getAppliances().size() == 0) { tempActivities.remove(i); } else selectedAppliances.addElement(tempActivities.get(i).toString()); } } // In case of an error. else { int temp = 8 + ((int) (Math.random() * 2)); for (int i = 0; i < temp; i++) { String name = "Appliance " + i; String powerModel = ""; String reactiveModel = ""; int tempIndex = i % 5; switch (tempIndex) { case 0: powerModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"p\":1900,\"d\":1,\"s\":0}]},{\"n\":0,\"values\":[{\"p\":300,\"d\":1,\"s\":0}]}]}"; reactiveModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"q\":-40,\"d\":1,\"s\":0}]},{\"n\":0,\"values\":[{\"q\":-10,\"d\":1,\"s\":0}]}]}"; break; case 1: powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 140.0, \"d\" : 20, \"s\": 0.0}]}]}"; reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : 120.0, \"d\" : 20, \"s\": 0.0}]}]}"; break; case 2: powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 95.0, \"d\" : 20, \"s\": 0.0}, {\"p\" :80.0, \"d\" : 18, \"s\": 0.0}, {\"p\" : 0.0, \"d\" : 73, \"s\": 0.0}]}]}]}"; reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : 0.0, \"d\" : 20, \"s\": 0.0}, {\"q\" : 0.0, \"d\" : 18, \"s\": 0.0}, {\"q\" : 0.0, \"d\" : 73, \"s\": 0.0}]}]}]}"; break; case 3: powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 30.0, \"d\" : 20, \"s\": 0.0}]}]}"; reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : -5.0, \"d\" : 20, \"s\": 0.0}]}]}"; break; case 4: powerModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"p\":150,\"d\":25,\"s\":0},{\"p\":2000,\"d\":13,\"s\":0},{\"p\":100,\"d\":62,\"s\":0}]}]}"; reactiveModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"q\":400,\"d\":25,\"s\":0},{\"q\":200,\"d\":13,\"s\":0},{\"q\":300,\"d\":62,\"s\":0}]}]}"; break; } Appliance tempAppliance = new Appliance(name, installation.getName(), powerModel, reactiveModel, "Demo/eventsAll" + tempIndex + ".csv"); installation.addAppliance(tempAppliance); detectedAppliances.addElement(tempAppliance.toString()); selectedAppliances.addElement(tempAppliance.toString()); exportModels.addElement(tempAppliance.toString()); } } // Enable all appliance/activity lists detectedApplianceList.setEnabled(true); detectedApplianceList.setModel(detectedAppliances); detectedApplianceList.setSelectedIndex(0); tabbedPane.setEnabledAt(1, true); selectedApplianceList.setEnabled(true); selectedApplianceList.setModel(selectedAppliances); // exportModelList.setEnabled(true); // exportModelList.setModel(exportModels); // tabbedPane.setEnabledAt(3, true); // Disable unnecessary buttons. disaggregateButton.setEnabled(false); createEventsButton.setEnabled(false); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); createEventsButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Create Events * button on the Data File panel of the Import Data tab. This button is * used when there is a single appliance with an known consumption model * so that the events can be extracted automatically from the data set. * Used for presentation purposes only since is depricated by the * disaggregation function. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Parse the consumption model file File file = new File(consumptionPathField.getText()); String temp = file.getName(); temp = temp.replace(".", " "); String name = temp.split(" ")[0]; Appliance appliance = null; try { int rand = (int) (Math.random() * 5); appliance = new Appliance(name, consumptionPathField.getText(), consumptionPathField.getText(), "Demo/eventsAll" + rand + ".csv", installation, activePowerRadioButton.isSelected()); } catch (IOException e1) { e1.printStackTrace(); } // Add appliance to the installation entity installation.addAppliance(appliance); // Enable all appliance/activity lists detectedAppliances.addElement(appliance.toString()); selectedAppliances.addElement(appliance.toString()); exportModels.addElement(appliance.toString()); detectedApplianceList.setEnabled(true); detectedApplianceList.setModel(detectedAppliances); detectedApplianceList.setSelectedIndex(0); tabbedPane.setEnabledAt(1, true); selectedApplianceList.setEnabled(true); selectedApplianceList.setModel(selectedAppliances); // exportModelList.setEnabled(true); // exportModelList.setModel(exportModels); // tabbedPane.setEnabledAt(3, true); // Disable unnecessary buttons. disaggregateButton.setEnabled(false); createEventsButton.setEnabled(false); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); // APPLIANCE DETECTION // detectedApplianceList.addListSelectionListener(new ListSelectionListener() { /** * This function is called when the user selects an appliance from the * list of Detected Appliances on the Disaggregation panel of the Import * Data tab. Then the corresponding consumption model is presented in the * Consumption Model Preview panel. */ @Override public void valueChanged(ListSelectionEvent e) { consumptionModelPanel.removeAll(); consumptionModelPanel.updateUI(); if (detectedAppliances.size() >= 1) { String selection = detectedApplianceList.getSelectedValue(); Appliance current = installation.findAppliance(selection); ChartPanel chartPanel = current.consumptionGraph(); consumptionModelPanel.add(chartPanel, BorderLayout.CENTER); consumptionModelPanel.validate(); } } }); // // TRAINING TAB // trainingTab.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent arg0) { selectedApplianceList.setSelectedIndex(0); } }); trainingButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Train button on * the Training Parameters panel of the Train Activity Models tab. It * contains the procedure needed to create an activity model based on the * event set of the appliance or activity. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); responsePanel.removeAll(); responsePanel.validate(); pricingPreviewPanel.removeAll(); pricingPreviewPanel.validate(); previewResponseButton.setEnabled(false); createResponseButton.setEnabled(false); createResponseAllButton.setEnabled(false); dailyResponseButton.setEnabled(false); startResponseButton.setEnabled(false); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Searching for existing activity or appliance. String selection = selectedApplianceList.getSelectedValue(); ActivityTemp activity = null; if (tempActivities.size() > 0) activity = tempActivities.get(findActivity(selection)); Appliance current = installation.findAppliance(selection); String startTime, duration, dailyTimes; // Check for the selected distribution methods for training. if (timesHistogramRadioButton.isSelected()) dailyTimes = "Histogram"; else if (timesNormalRadioButton.isSelected()) dailyTimes = "Normal"; else dailyTimes = "GMM"; if (durationHistogramRadioButton.isSelected()) duration = "Histogram"; else if (durationNormalRadioButton.isSelected()) duration = "Normal"; else duration = "GMM"; if (startHistogramRadioButton.isSelected()) startTime = "Histogram"; else if (startNormalRadioButton.isSelected()) startTime = "Normal"; else startTime = "GMM"; String[] distributions = { dailyTimes, duration, startTime, "Histogram" }; // If the selected object from the list is an appliance the training // procedure for the appliance begins. if (activity == null) { try { installation.getPerson().train(current, distributions); } catch (IOException e1) { e1.printStackTrace(); } } // If the selected object from the list is an activity the training // procedure for the activity begins. else { try { installation.getPerson().train(activity, distributions); } catch (IOException e1) { e1.printStackTrace(); } } // System.out.println("Training OK!"); distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); expectedPowerPanel.removeAll(); expectedPowerPanel.updateUI(); // Show the distribution created on the Distribution Preview Panel ActivityModel activityModel = installation.getPerson().findActivity(selection, true); if (activityModel == null) activityModel = installation.getPerson().findActivity(current); ChartPanel chartPanel = activityModel.createDailyTimesDistributionChart(); distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER); distributionPreviewPanel.validate(); chartPanel = activityModel.createExpectedPowerChart(); expectedPowerPanel.add(chartPanel, BorderLayout.CENTER); expectedPowerPanel.validate(); // Add the Activity model to the list of trained Activity models of // the Create Response Models tab int size = activitySelectList.getModel().getSize(); if (size > 0) { activityModels = (DefaultListModel<String>) activitySelectList.getModel(); if (activityModels.contains(activityModel.getName()) == false) activityModels.addElement(activityModel.getName()); } else { activityModels = new DefaultListModel<String>(); activityModels.addElement(activityModel.getName()); activitySelectList.setEnabled(true); } activitySelectList.setModel(activityModels); // Add the trained model to the export list also. size = exportModelList.getModel().getSize(); if (size > 0) { exportModels = (DefaultListModel<String>) exportModelList.getModel(); if (exportModels.contains(activityModel.getName()) == false) exportModels.addElement(activityModel.getName()); } else { exportModels = new DefaultListModel<String>(); exportModels.addElement(activityModel.getName()); exportModelList.setEnabled(true); } // Enable some buttons necessary to show the results. dailyTimesButton.setEnabled(true); durationButton.setEnabled(true); startTimeButton.setEnabled(true); startTimeBinnedButton.setEnabled(true); exportModelList.setModel(exportModels); exportDailyButton.setEnabled(true); exportDurationButton.setEnabled(true); exportStartButton.setEnabled(true); exportStartBinnedButton.setEnabled(true); tabbedPane.setEnabledAt(2, true); } finally { root.setCursor(Cursor.getDefaultCursor()); trained = true; } } }); trainAllButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Train All button on * the Training Parameters panel of the Train Activity Models tab. It * is iterating the aforementioned training procedure to each of the * objects on the list. */ @Override public void actionPerformed(ActionEvent e) { responsePanel.removeAll(); responsePanel.validate(); pricingPreviewPanel.removeAll(); pricingPreviewPanel.validate(); previewResponseButton.setEnabled(false); createResponseButton.setEnabled(false); createResponseAllButton.setEnabled(false); dailyResponseButton.setEnabled(false); startResponseButton.setEnabled(false); for (int i = 0; i < selectedApplianceList.getModel().getSize(); i++) { selectedApplianceList.setSelectedIndex(i); trainingButton.doClick(); } } }); dailyTimesButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Daily Times button on * the Distribution Preview panel of the Train Activity Models tab. It * shows the Daily Times Distribution for the selected object from the * list if available. */ @Override public void actionPerformed(ActionEvent arg0) { distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); String selection = selectedApplianceList.getSelectedValue(); Appliance current = installation.findAppliance(selection); ActivityModel activityModel = installation.getPerson().findActivity(selection, true); if (activityModel == null) activityModel = installation.getPerson().findActivity(current); ChartPanel chartPanel = activityModel.createDailyTimesDistributionChart(); distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER); distributionPreviewPanel.validate(); } }); startTimeBinnedButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Start Time Binned * button on the Distribution Preview panel of the Train Activity * Models tab. It shows the Start Time Binned Distribution for the * selected object from the list if available. */ @Override public void actionPerformed(ActionEvent arg0) { distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); String selection = selectedApplianceList.getSelectedValue(); Appliance current = installation.findAppliance(selection); ActivityModel activityModel = installation.getPerson().findActivity(selection, true); if (activityModel == null) activityModel = installation.getPerson().findActivity(current); ChartPanel chartPanel = activityModel.createStartTimeBinnedDistributionChart(); distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER); distributionPreviewPanel.validate(); } }); startTimeButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Start Time * button on the Distribution Preview panel of the Train Activity * Models tab. It shows the Start Time Distribution for the selected * object from the list if available. */ @Override public void actionPerformed(ActionEvent arg0) { distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); String selection = selectedApplianceList.getSelectedValue(); Appliance current = installation.findAppliance(selection); ActivityModel activityModel = installation.getPerson().findActivity(selection, true); if (activityModel == null) activityModel = installation.getPerson().findActivity(current); ChartPanel chartPanel = activityModel.createStartTimeDistributionChart(); distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER); distributionPreviewPanel.validate(); } }); durationButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Duration * button on the Distribution Preview panel of the Train Activity * Models tab. It shows the Duration Distribution for the selected * object from the list if available. */ @Override public void actionPerformed(ActionEvent arg0) { distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); String selection = selectedApplianceList.getSelectedValue(); Appliance current = installation.findAppliance(selection); ActivityModel activityModel = installation.getPerson().findActivity(selection, true); if (activityModel == null) activityModel = installation.getPerson().findActivity(current); ChartPanel chartPanel = activityModel.createDurationDistributionChart(); distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER); distributionPreviewPanel.validate(); } }); selectedApplianceList.addListSelectionListener(new ListSelectionListener() { /** * This function is called when the user selects an appliance or activity * from the list of Selected Appliances on the Appliance / Activity * Selection panel of the Train Activity Models tab. Then an example * corresponding consumption model is presented in the Consumption Model * Preview panel. */ @Override public void valueChanged(ListSelectionEvent arg0) { ChartPanel chartPanel = null, chartPanel2 = null, chartPanel3 = null; expectedPowerPanel.removeAll(); expectedPowerPanel.updateUI(); distributionPreviewPanel.removeAll(); distributionPreviewPanel.updateUI(); // If there are any appliances / activities on the list if (selectedAppliances.size() >= 1) { // Find the corresponding appliance / activity and show its // consumption model String selection = selectedApplianceList.getSelectedValue(); Appliance currentAppliance = installation.findAppliance(selection); ActivityModel activityModel = installation.getPerson().findActivity(selection, true); // If there is also an Activity model trained, show the corresponding // distribution charts on the Distribution Preview panel if (currentAppliance != null) activityModel = installation.getPerson().findActivity(currentAppliance); if (activityModel == null) activityModel = installation.getPerson().findActivity(selection, true); if (activityModel != null) { dailyTimesButton.setEnabled(true); durationButton.setEnabled(true); startTimeButton.setEnabled(true); startTimeBinnedButton.setEnabled(true); chartPanel2 = activityModel.createDailyTimesDistributionChart(); distributionPreviewPanel.add(chartPanel2, BorderLayout.CENTER); distributionPreviewPanel.validate(); distributionPreviewPanel.updateUI(); chartPanel3 = activityModel.createExpectedPowerChart(); expectedPowerPanel.add(chartPanel3, BorderLayout.CENTER); expectedPowerPanel.validate(); expectedPowerPanel.updateUI(); } else { dailyTimesButton.setEnabled(false); durationButton.setEnabled(false); startTimeButton.setEnabled(false); startTimeBinnedButton.setEnabled(false); } } } }); // RESPONSE TAB // createResponseTab.addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent arg0) { activitySelectList.setSelectedIndex(0); } @Override public void componentShown(ComponentEvent arg0) { activitySelectList.setSelectedIndex(0); } }); previewResponseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Preview Response * button on the Response Parameters panel of the Create Response Models * tab. This button is enabled after selecting activity model, response * type and pricing for testing and presents a preview of the response * model that may be extracted. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); responsePanel.removeAll(); // Find the selected activity ActivityModel activity = installation.getPerson() .findActivity(activitySelectList.getSelectedValue(), false); int response = -1; // Check for the selected response type if (optimalCaseRadioButton.isSelected()) response = 0; else if (normalCaseRadioButton.isSelected()) response = 1; else response = 2; // Parse the pricing schemes double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText()); double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText()); float awareness = (float) (awarenessSlider.getValue()) / 100; float sensitivity = (float) (sensitivitySlider.getValue()) / 100; System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity); // Create a preview chart of the response model ChartPanel chartPanel = installation.getPerson().previewResponse(activity, response, basicScheme, newScheme, awareness, sensitivity); responsePanel.add(chartPanel, BorderLayout.CENTER); responsePanel.validate(); createResponseButton.setEnabled(true); createResponseAllButton.setEnabled(true); dailyResponseButton.setEnabled(true); startResponseButton.setEnabled(true); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); createResponseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Create Response Model * button on the Response Parameters panel of the Create Response Models * tab. This button is enabled after preview results of the selected * activity model, response type and pricing for testing and creates the * response model for the user. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); int responseType = -1; String responseString = ""; // Check for the selected response type if (optimalCaseRadioButton.isSelected()) { responseType = 0; responseString = "Optimal"; } else if (normalCaseRadioButton.isSelected()) { responseType = 1; responseString = "Normal"; } else if (discreteCaseRadioButton.isSelected()) { responseType = 2; responseString = "Discrete"; } // Parse the pricing schemes double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText()); double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText()); // Create the response model ActivityModel activity = installation.getPerson() .findActivity(activitySelectList.getSelectedValue(), false); String response = ""; float awareness = (float) (awarenessSlider.getValue()) / 100; float sensitivity = (float) (sensitivitySlider.getValue()) / 100; System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity); try { response = installation.getPerson().createResponse(activity, responseType, basicScheme, newScheme, awareness, sensitivity); } catch (IOException exc) { exc.printStackTrace(); } // Add the response model extracted to the export model list. int size = exportModelList.getModel().getSize(); // System.out.println(size); if (size > 0) { exportModels = (DefaultListModel<String>) exportModelList.getModel(); String response2 = "", response3 = ""; if (responseString.equalsIgnoreCase("Optimal")) { response2 = response.replace(responseString, "Normal"); response3 = response.replace(responseString, "Discrete"); } else if (responseString.equalsIgnoreCase("Normal")) { response2 = response.replace(responseString, "Optimal"); response3 = response.replace(responseString, "Discrete"); } else { response2 = response.replace(responseString, "Optimal"); response3 = response.replace(responseString, "Normal"); } if (exportModels.contains(response2)) exportModels.removeElement(response2); if (exportModels.contains(response3)) exportModels.removeElement(response3); if (exportModels.contains(response) == false) exportModels.addElement(response); } else { exportModels = new DefaultListModel<String>(); exportModels.addElement(response); exportModelList.setEnabled(true); } exportModelList.setModel(exportModels); if (manyFlag == false) { JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The response model " + response + " was created successfully", "Response Model Created", JOptionPane.INFORMATION_MESSAGE); } } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); createResponseAllButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Create Response All * button on the Response Parameters panel of the Create Response Models * tab. This is achieved by iterating the procedure above for all the * available activity models in the list. */ @Override public void actionPerformed(ActionEvent arg0) { manyFlag = true; for (int i = 0; i < activitySelectList.getModel().getSize(); i++) { activitySelectList.setSelectedIndex(i); createResponseButton.doClick(); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The response models were created successfully", "Response Models Created", JOptionPane.INFORMATION_MESSAGE); manyFlag = false; } }); newPricingSchemePane.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent arg0) { commitButton.setEnabled(true); } }); basicPricingSchemePane.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent arg0) { commitButton.setEnabled(true); } }); commitButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Commit button on the * Pricing Scheme panel of the Create Response Models tab. This button is * enabled after adding the two pricing schemes that are prerequisites for * the creation of a response model. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean basicScheme = false; boolean newScheme = false; int parseBasic = 0; int parseNew = 0; pricingPreviewPanel.removeAll(); // Check if both pricing schemes are entered if (basicPricingSchemePane.getText().equalsIgnoreCase("") == false) basicScheme = true; if (newPricingSchemePane.getText().equalsIgnoreCase("") == false) newScheme = true; // Parse the pricing schemes for errors if (basicScheme) parseBasic = Utils.parsePricingScheme(basicPricingSchemePane.getText()); if (newScheme) parseNew = Utils.parsePricingScheme(newPricingSchemePane.getText()); // If errors are found then present the line the error may be at if (parseBasic != -1) { JFrame error = new JFrame(); JOptionPane.showMessageDialog(error, "Basic Pricing Scheme is not defined correctly. Please check your input in line " + parseBasic + " and try again.", "Inane error", JOptionPane.ERROR_MESSAGE); } else if (parseNew != -1) { JFrame error = new JFrame(); JOptionPane.showMessageDialog(error, "New Pricing Scheme is not defined correctly. Please check your input in line " + parseNew + " and try again.", "Inane error", JOptionPane.ERROR_MESSAGE); } // If no errors are found make a preview chart of the two pricing // schemes else { if (basicScheme && newScheme) { ChartPanel chartPanel = ChartUtils.parsePricingScheme(basicPricingSchemePane.getText(), newPricingSchemePane.getText()); pricingPreviewPanel.add(chartPanel, BorderLayout.CENTER); pricingPreviewPanel.validate(); previewResponseButton.setEnabled(true); } else { JFrame error = new JFrame(); JOptionPane.showMessageDialog(error, "You have not defined both pricing schemes.Please check your input and try again.", "Inane error", JOptionPane.ERROR_MESSAGE); previewResponseButton.setEnabled(false); } } responsePanel.removeAll(); responsePanel.validate(); createResponseButton.setEnabled(false); createResponseAllButton.setEnabled(false); dailyResponseButton.setEnabled(false); startResponseButton.setEnabled(false); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); startResponseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the start time button on * the Preview Response panel of the Create Response Models tab. This * button is enabled after the user has pressed the Response Preview * button in order to see the results of his pricing scheme on a activity * model. It shows the changes in the start time distribution. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); responsePanel.removeAll(); // Find the selected activity ActivityModel activity = installation.getPerson() .findActivity(activitySelectList.getSelectedValue(), false); int response = -1; // Check for the selected response type if (optimalCaseRadioButton.isSelected()) response = 0; else if (normalCaseRadioButton.isSelected()) response = 1; else response = 2; // Parse the pricing schemes double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText()); double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText()); float awareness = (float) (awarenessSlider.getValue()) / 100; float sensitivity = (float) (sensitivitySlider.getValue()) / 100; System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity); // Create a preview chart of the response model ChartPanel chartPanel = installation.getPerson().previewResponse(activity, response, basicScheme, newScheme, awareness, sensitivity); responsePanel.add(chartPanel, BorderLayout.CENTER); responsePanel.validate(); createResponseButton.setEnabled(true); createResponseAllButton.setEnabled(true); dailyResponseButton.setEnabled(true); startResponseButton.setEnabled(true); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); dailyResponseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the start time button on * the Preview Response panel of the Create Response Models tab. This * button is enabled after the user has pressed the Response Preview * button in order to see the results of his pricing scheme on a activity * model. It shows the changes in the daily times distribution. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); responsePanel.removeAll(); // Find the selected activity ActivityModel activity = installation.getPerson() .findActivity(activitySelectList.getSelectedValue(), false); // Parse the pricing schemes double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText()); double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText()); float awareness = (float) (awarenessSlider.getValue()) / 100; float sensitivity = (float) (sensitivitySlider.getValue()) / 100; System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity); // Create a preview chart of the response model ChartPanel chartPanel = installation.getPerson().previewDailyResponse(activity, basicScheme, newScheme, awareness, sensitivity); responsePanel.add(chartPanel, BorderLayout.CENTER); responsePanel.validate(); createResponseButton.setEnabled(true); createResponseAllButton.setEnabled(true); dailyResponseButton.setEnabled(true); startResponseButton.setEnabled(true); } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); // EXPORT TAB // exportTab.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent arg0) { exportModelList.setSelectedIndex(0); } }); exportModelList.addListSelectionListener(new ListSelectionListener() { /** * This function is called when the user selects an entity from the * list of models on the Model Export Selection panel of the Export Models * tab. Then the corresponding preview of the entity model is presented in * the * Export Model Preview panel. */ @Override public void valueChanged(ListSelectionEvent arg0) { if (tabbedPane.getSelectedIndex() == 3) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); // Checking if the list has any object if (exportModels.size() > 1) { String selection = exportModelList.getSelectedValue(); // Check to see what type of entity is selected (Installation, // Person, Appliance, Activity, Response) Appliance appliance = installation.findAppliance(selection); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); // Create the appropriate chart for the selected entity and show it. ChartPanel chartPanel = null; if (selection.equalsIgnoreCase(installation.getName())) { try { chartPanel = installation.measurementsChart(); exportDailyButton.setEnabled(false); exportDurationButton.setEnabled(false); exportStartButton.setEnabled(false); exportStartBinnedButton.setEnabled(false); if (trained) exportExpectedPowerButton.setEnabled(true); else exportExpectedPowerButton.setEnabled(false); } catch (IOException e1) { e1.printStackTrace(); } } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) { chartPanel = installation.getPerson().statisticGraphs(); exportDailyButton.setEnabled(false); exportDurationButton.setEnabled(false); exportStartButton.setEnabled(false); exportStartBinnedButton.setEnabled(false); exportExpectedPowerButton.setEnabled(false); } else if (appliance != null) { chartPanel = appliance.consumptionGraph(); exportDailyButton.setEnabled(false); exportDurationButton.setEnabled(false); exportStartButton.setEnabled(false); exportStartBinnedButton.setEnabled(false); exportExpectedPowerButton.setEnabled(false); } else if (activity != null) { chartPanel = activity.createDailyTimesDistributionChart(); activity.status(); exportDailyButton.setEnabled(true); exportDurationButton.setEnabled(true); exportStartButton.setEnabled(true); exportStartBinnedButton.setEnabled(true); exportExpectedPowerButton.setEnabled(true); } else if (response != null) { chartPanel = response.createDailyTimesDistributionChart(); exportDailyButton.setEnabled(true); exportDurationButton.setEnabled(true); exportStartButton.setEnabled(true); exportStartBinnedButton.setEnabled(true); exportExpectedPowerButton.setEnabled(true); } exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } } } }); exportDailyButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Daily Times * button on the Entity Preview panel of the Export Models tab. It shows * the Daily Times Distribution for the selected object from the list. */ @Override public void actionPerformed(ActionEvent arg0) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); String selection = exportModelList.getSelectedValue(); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); ChartPanel chartPanel = null; if (activity != null) chartPanel = activity.createDailyTimesDistributionChart(); else chartPanel = response.createDailyTimesDistributionChart(); exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } }); exportStartBinnedButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Start Time Binned * button on the Entity Preview panel of the Export Models tab. It shows * the Start Time Binned Distribution for the selected object from the * list. */ @Override public void actionPerformed(ActionEvent arg0) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); String selection = exportModelList.getSelectedValue(); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); ChartPanel chartPanel = null; if (activity != null) chartPanel = activity.createStartTimeBinnedDistributionChart(); else chartPanel = response.createStartTimeBinnedDistributionChart(); exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } }); exportStartButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Start Time * button on the Entity Preview panel of the Export Models tab. It shows * the Start Time Distribution for the selected object from the list. */ @Override public void actionPerformed(ActionEvent arg0) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); String selection = exportModelList.getSelectedValue(); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); ChartPanel chartPanel = null; if (activity != null) chartPanel = activity.createStartTimeDistributionChart(); else chartPanel = response.createStartTimeDistributionChart(); exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } }); exportDurationButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Duration * button on the Entity Preview panel of the Export Models tab. It shows * the Duration Distribution for the selected object from the list. */ @Override public void actionPerformed(ActionEvent arg0) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); String selection = exportModelList.getSelectedValue(); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); ChartPanel chartPanel = null; if (activity != null) chartPanel = activity.createDurationDistributionChart(); else chartPanel = response.createDurationDistributionChart(); exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } }); exportExpectedPowerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { exportPreviewPanel.removeAll(); exportPreviewPanel.updateUI(); String selection = exportModelList.getSelectedValue(); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); ChartPanel chartPanel = null; if (selection.equalsIgnoreCase(installation.getName())) chartPanel = installation.createExpectedPowerChart(); else if (activity != null) chartPanel = activity.createExpectedPowerChart(); else chartPanel = response.createExpectedPowerChart(); exportPreviewPanel.add(chartPanel, BorderLayout.CENTER); exportPreviewPanel.validate(); } }); connectButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Connect button on the * Connection Properties panel of the Export Models tab. It helps the user * to connect to his Cassandra Library and export the models he created * there. */ @Override public void actionPerformed(ActionEvent e) { boolean result = false; // Reads the user credentials and the server to connect to. try { APIUtilities.setUrl(urlTextField.getText()); result = APIUtilities.sendUserCredentials(usernameTextField.getText(), passwordField.getPassword()); } catch (Exception e1) { e1.printStackTrace(); } // If the use credentials are correct if (result) { exportButton.setEnabled(true); exportAllBaseButton.setEnabled(true); exportAllResponseButton.setEnabled(true); householdNameTextField.setEnabled(true); } // Else a error message appears. else { JFrame error = new JFrame(); JOptionPane.showMessageDialog(error, "User Credentials are not correct! Please try again.", "Inane error", JOptionPane.ERROR_MESSAGE); passwordField.setText(""); } } }); passwordField.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { String pass = String.valueOf(passwordField.getPassword()); if (pass.equals("")) { connectButton.setEnabled(false); } else connectButton.setEnabled(true); } }); exportButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Export button on the * Connection Properties panel of the Export Models tab. The entity model * selected from the list is then exported to the User Library in * Cassandra Platform. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Parsing the selected entity and find out what type of entity it is. String selection = exportModelList.getSelectedValue(); Appliance appliance = installation.findAppliance(selection); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); // If it is installation if (selection.equalsIgnoreCase(installation.getName())) { String oldName = installation.getName(); installation.setName(householdNameTextField.getText()); try { installation.setInstallationID(APIUtilities .sendEntity(installation.toJSON(APIUtilities.getUserID()).toString(), "/inst")); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } installation.setName(oldName); JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The installation model " + installation.getName() + " was exported successfully", "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE); } // If it is person else if (selection.equalsIgnoreCase(installation.getPerson().getName())) { try { installation.getPerson().setPersonID(APIUtilities.sendEntity( installation.getPerson().toJSON(APIUtilities.getUserID()).toString(), "/pers")); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The person model " + installation.getPerson().getName() + " was exported successfully", "Person Model Exported", JOptionPane.INFORMATION_MESSAGE); } // If it is appliance else if (appliance != null) { try { appliance.setApplianceID(APIUtilities .sendEntity(appliance.toJSON(APIUtilities.getUserID()).toString(), "/app")); APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(), "/consmod"); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The appliance model " + appliance.getName() + " was exported successfully", "Appliance Model Exported", JOptionPane.INFORMATION_MESSAGE); } // If it is activity else if (activity != null) { String[] applianceTemp = new String[activity.getAppliancesOf().length]; String activityTemp = ""; String durationTemp = ""; String dailyTemp = ""; String startTemp = ""; // For each appliance that participates in the activity for (int i = 0; i < activity.getAppliancesOf().length; i++) { Appliance activityAppliance = activity.getAppliancesOf()[i]; try { // In case the appliances contained in the Activity model are // not // in the database, we create the object there before sending // the // activity model if (activityAppliance.getApplianceID().equalsIgnoreCase("")) { activityAppliance.setApplianceID(APIUtilities.sendEntity( activityAppliance.toJSON(APIUtilities.getUserID()).toString(), "/app")); APIUtilities.sendEntity( activityAppliance.powerConsumptionModelToJSON().toString(), "/consmod"); } applianceTemp[i] = activityAppliance.getApplianceID(); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } try { String[] appliancesID = applianceTemp; // Creating the JSON of the activity model activity.setActivityModelID(APIUtilities.sendEntity( activity.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod")); activityTemp = activity.getActivityModelID(); // Creating the JSON of the distributions activity.getDailyTimes().setDistributionID(APIUtilities.sendEntity( activity.getDailyTimes().toJSON(activityTemp).toString(), "/distr")); activity.setDailyID(activity.getDailyTimes().getDistributionID()); dailyTemp = activity.getDailyID(); activity.getDuration().setDistributionID(APIUtilities .sendEntity(activity.getDuration().toJSON(activityTemp).toString(), "/distr")); activity.setDurationID(activity.getDuration().getDistributionID()); durationTemp = activity.getDurationID(); activity.getStartTime().setDistributionID(APIUtilities .sendEntity(activity.getStartTime().toJSON(activityTemp).toString(), "/distr")); activity.setStartID(activity.getStartTime().getDistributionID()); startTemp = activity.getStartID(); // Adding the JSON of the distributions to the activity model APIUtilities.updateEntity( activity.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod", activityTemp); } catch (AuthenticationException | NoSuchAlgorithmException | IOException e1) { e1.printStackTrace(); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The activity model " + activity.getName() + " was exported successfully", "Activity Model Exported", JOptionPane.INFORMATION_MESSAGE); } // If it is response else if (response != null) { String[] applianceTemp = new String[response.getAppliancesOf().length]; String responseTemp = ""; String durationTemp = ""; String dailyTemp = ""; String startTemp = ""; // For each appliance that participates in the activity for (int i = 0; i < response.getAppliancesOf().length; i++) { Appliance responseAppliance = response.getAppliancesOf()[i]; try { // In case the appliances contained in the Activity model are // not // in the database, we create the object there before sending // the // activity model if (responseAppliance.getApplianceID().equalsIgnoreCase("")) { responseAppliance.setApplianceID(APIUtilities.sendEntity( responseAppliance.toJSON(APIUtilities.getUserID()).toString(), "/app")); APIUtilities.sendEntity( responseAppliance.powerConsumptionModelToJSON().toString(), "/consmod"); } applianceTemp[i] = responseAppliance.getApplianceID(); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } try { String[] appliancesID = applianceTemp; // Creating the JSON of the response response.setActivityModelID(APIUtilities.sendEntity( response.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod")); responseTemp = response.getActivityModelID(); // Creating the JSON of the distributions response.getDailyTimes().setDistributionID(APIUtilities.sendEntity( response.getDailyTimes().toJSON(responseTemp).toString(), "/distr")); response.setDailyID(response.getDailyTimes().getDistributionID()); dailyTemp = response.getDailyID(); response.getDuration().setDistributionID(APIUtilities .sendEntity(response.getDuration().toJSON(responseTemp).toString(), "/distr")); response.setDurationID(response.getDuration().getDistributionID()); durationTemp = response.getDurationID(); response.getStartTime().setDistributionID(APIUtilities .sendEntity(response.getStartTime().toJSON(responseTemp).toString(), "/distr")); response.setStartID(response.getStartTime().getDistributionID()); startTemp = response.getStartID(); // Adding the JSON of the distributions to the activity model APIUtilities.updateEntity( response.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod", responseTemp); } catch (AuthenticationException | NoSuchAlgorithmException | IOException e1) { e1.printStackTrace(); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The response model " + response.getName() + " was exported successfully", "Response Model Exported", JOptionPane.INFORMATION_MESSAGE); } } finally { root.setCursor(Cursor.getDefaultCursor()); } } }); exportAllBaseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Export All Base * button on the Connection Properties panel of the Export Models tab. The * export procedure above is iterated through all the entities available * on the list except for the response models. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (int i = 0; i < exportModelList.getModel().getSize(); i++) { exportModelList.setSelectedIndex(i); String selection = exportModelList.getSelectedValue(); Appliance appliance = installation.findAppliance(selection); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); if (selection.equalsIgnoreCase(installation.getName())) { String oldName = installation.getName(); try { installation.setName(householdNameTextField.getText() + " Base"); installation.setInstallationID(APIUtilities.sendEntity( installation.toJSON(APIUtilities.getUserID()).toString(), "/inst")); installation.setName(oldName); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) { try { installation.getPerson().setPersonID(APIUtilities.sendEntity(installation .getPerson().toJSON(installation.getInstallationID()).toString(), "/pers")); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (appliance != null) { try { appliance.setApplianceID(APIUtilities.sendEntity( appliance.toJSON(installation.getInstallationID().toString()).toString(), "/app")); APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(), "/consmod"); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (activity != null) { String[] applianceTemp = new String[activity.getAppliancesOf().length]; String personTemp = ""; String activityTemp = ""; String durationTemp = ""; String dailyTemp = ""; String startTemp = ""; // For each appliance that participates in the activity for (int j = 0; j < activity.getAppliancesOf().length; j++) { Appliance activityAppliance = activity.getAppliancesOf()[j]; applianceTemp[j] = activityAppliance.getApplianceID(); } personTemp = installation.getPerson().getPersonID(); try { activity.setActivityID(APIUtilities .sendEntity(activity.activityToJSON(personTemp).toString(), "/act")); String[] appliancesID = applianceTemp; activity.setActivityModelID(APIUtilities .sendEntity(activity.toJSON(appliancesID).toString(), "/actmod")); activityTemp = activity.getActivityModelID(); activity.getDailyTimes().setDistributionID(APIUtilities.sendEntity( activity.getDailyTimes().toJSON(activityTemp).toString(), "/distr")); activity.setDailyID(activity.getDailyTimes().getDistributionID()); dailyTemp = activity.getDailyID(); activity.getDuration().setDistributionID(APIUtilities.sendEntity( activity.getDuration().toJSON(activityTemp).toString(), "/distr")); activity.setDurationID(activity.getDuration().getDistributionID()); durationTemp = activity.getDurationID(); activity.getStartTime().setDistributionID(APIUtilities.sendEntity( activity.getStartTime().toJSON(activityTemp).toString(), "/distr")); activity.setStartID(activity.getStartTime().getDistributionID()); startTemp = activity.getStartID(); APIUtilities.updateEntity(activity.toJSON(appliancesID).toString(), "/actmod", activityTemp); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (response != null) { } } } finally { root.setCursor(Cursor.getDefaultCursor()); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The installation model " + installation.getName() + " for the base pricing scheme and all the entities contained within were exported successfully", "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE); } }); exportAllResponseButton.addActionListener(new ActionListener() { /** * This function is called when the user presses the Export All Base * button on the Connection Properties panel of the Export Models tab. The * export procedure above is iterated through all the entities available * on the list except for the activity models. */ @Override public void actionPerformed(ActionEvent e) { Component root = SwingUtilities.getRoot((JButton) e.getSource()); try { root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (int i = 0; i < exportModelList.getModel().getSize(); i++) { exportModelList.setSelectedIndex(i); String selection = exportModelList.getSelectedValue(); Appliance appliance = installation.findAppliance(selection); ActivityModel activity = installation.getPerson().findActivity(selection, false); ResponseModel response = installation.getPerson().findResponse(selection); if (selection.equalsIgnoreCase(installation.getName())) { String oldName = installation.getName(); try { installation.setName(householdNameTextField.getText() + " Response"); installation.setInstallationID(APIUtilities.sendEntity( installation.toJSON(APIUtilities.getUserID()).toString(), "/inst")); installation.setName(oldName); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) { try { installation.getPerson().setPersonID(APIUtilities.sendEntity(installation .getPerson().toJSON(installation.getInstallationID()).toString(), "/pers")); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (appliance != null) { try { appliance.setApplianceID(APIUtilities.sendEntity( appliance.toJSON(installation.getInstallationID().toString()).toString(), "/app")); APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(), "/consmod"); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } else if (activity != null) { } else if (response != null) { String[] applianceTemp = new String[response.getAppliancesOf().length]; String personTemp = ""; String responseTemp = ""; String durationTemp = ""; String dailyTemp = ""; String startTemp = ""; // For each appliance that participates in the activity for (int j = 0; j < response.getAppliancesOf().length; j++) { Appliance responseAppliance = response.getAppliancesOf()[j]; applianceTemp[j] = responseAppliance.getApplianceID(); } personTemp = installation.getPerson().getPersonID(); try { response.setActivityID(APIUtilities .sendEntity(response.activityToJSON(personTemp).toString(), "/act")); String[] appliancesID = applianceTemp; response.setActivityModelID(APIUtilities .sendEntity(response.toJSON(appliancesID).toString(), "/actmod")); responseTemp = response.getActivityModelID(); response.getDailyTimes().setDistributionID(APIUtilities.sendEntity( response.getDailyTimes().toJSON(responseTemp).toString(), "/distr")); response.setDailyID(response.getDailyTimes().getDistributionID()); dailyTemp = response.getDailyID(); response.getDuration().setDistributionID(APIUtilities.sendEntity( response.getDuration().toJSON(responseTemp).toString(), "/distr")); response.setDurationID(response.getDuration().getDistributionID()); durationTemp = response.getDurationID(); response.getStartTime().setDistributionID(APIUtilities.sendEntity( response.getStartTime().toJSON(responseTemp).toString(), "/distr")); response.setStartID(response.getStartTime().getDistributionID()); startTemp = response.getStartID(); APIUtilities.updateEntity(response.toJSON(appliancesID).toString(), "/actmod", responseTemp); } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) { e1.printStackTrace(); } } } } finally { root.setCursor(Cursor.getDefaultCursor()); } JFrame success = new JFrame(); JOptionPane.showMessageDialog(success, "The installation model " + installation.getName() + " for the new pricing scheme and all the entities contained within were exported successfully", "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE); } }); }
From source file:com.juanhg.fridge.FridgeApplet.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("Tiempo On:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTValue = new JLabel(); lblTValue.setText("0"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("Eficiencia:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblEValue = new JLabel(); lblEValue.setText("0"); lblEValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblTiempoOff = new JLabel("Tiempo Off:"); lblTiempoOff.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblOffValue = new JLabel(); lblOffValue.setText("0"); lblOffValue.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, 351, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblO1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE) .addGap(31) .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(lblOffValue, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); gl_panelOutputs/* ww w . j a v a 2 s . co m*/ .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.LEADING) .addComponent(lblOffValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO1).addComponent(lblTValue)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))))); 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.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 305, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 76, 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(Alignment.TRAILING, 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(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Potencia"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("T1"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("T2"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblT1Value = new JLabel("20"); lblT1Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblT2Value = new JLabel("-15"); lblT2Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPValue = new JLabel("700"); lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderP = new JSlider(); sliderP.setMinimum(500); sliderP.setMaximum(1000); sliderP.setMinorTickSpacing(50); sliderP.setValue(700); sliderP.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderT1 = new JSlider(); sliderT1.setMinimum(18); sliderT1.setMaximum(30); sliderT1.setMinorTickSpacing(1); sliderT1.setValue(20); sliderT1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderT2 = new JSlider(); sliderT2.setMinimum(10); sliderT2.setMaximum(30); sliderT2.setValue(15); sliderT2.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblQo = new JLabel("Qo"); lblQo.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblQcValue = new JLabel("25"); lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderQc = new JSlider(); sliderQc.setMinimum(10); sliderQc.setMaximum(50); sliderQc.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderQc.setValue(25); sliderQc.setMinorTickSpacing(1); btn1 = new JButton("1"); btn1.setFont(new Font("Tahoma", Font.PLAIN, 21)); btn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnMilk.setEnabled(false); btnFish.setEnabled(false); btnMetal.setEnabled(false); btn1.setEnabled(false); btn2.setEnabled(true); sliderQc.setEnabled(true); lblQcValue.setText("" + sliderQc.getValue()); } }); btn2 = new JButton("2"); btn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMilk.setEnabled(true); btnFish.setEnabled(true); btnMetal.setEnabled(true); btn1.setEnabled(true); btn2.setEnabled(false); phase = 2; sliderQc.setEnabled(false); lblQcValue.setText("-"); } }); btn2.setFont(new Font("Tahoma", Font.PLAIN, 21)); fishImage = loadImage(fish); btnFish = new JButton(new ImageIcon(fishImage)); btnFish.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnFishFunction(); } }); milkImage = loadImage(milk); btnMilk = new JButton(new ImageIcon(milkImage)); btnMilk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMilkFunction(); } }); metalImage = loadImage(metal); btnMetal = new JButton(new ImageIcon(metalImage)); btnMetal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMetalFunction(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs .setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addGap(38).addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING).addGroup( gl_panelInputs.createSequentialGroup().addGap(36) .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING, false) .addComponent(lblQo, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelI1, GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING) .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING, false) .addComponent(sliderT1, 0, 0, Short.MAX_VALUE) .addComponent(sliderP, GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) .addComponent(sliderT2, 0, 0, Short.MAX_VALUE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderQc, 0, 0, Short.MAX_VALUE))))) .addContainerGap(14, Short.MAX_VALUE)) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addContainerGap(28, Short.MAX_VALUE) .addComponent(btnFish, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addGap(25))); 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(lblPValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderP, 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(lblT1Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderT1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderT2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblQo, 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(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE) .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup().addGap(1).addComponent(btnFish, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap(12, Short.MAX_VALUE))); 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, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 398, GroupLayout.PREFERRED_SIZE) .addGap(452))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout .createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addGap(12).addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)) .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); JPanel panel = new JPanel(); panelGrafica = new JPanelGrafica(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 384, Short.MAX_VALUE) .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)); panel.setLayout(gl_panel); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)); panel_visualizar.setLayout(gl_panel_visualizar); 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 ======== {/*from w w w .j a v a2s . 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.triangle.TriangleApplet.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("Tensi\u00F3n:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTValue = new JLabel(); lblTValue.setText("0"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("V:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO3 = new JLabel("tfinal:"); lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTfValue = new JLabel(); lblTfValue.setText("0"); lblTfValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblW = new JLabel("W:"); lblW.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblWValue = new JLabel(); lblWValue.setText("0"); lblWValue.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().addGap(22) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblO2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblO1, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblVValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTValue, GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO3, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblTfValue, GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); gl_panelOutputs//from w w w .j a v a 2 s. com .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.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblO1) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblTValue) .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent( lblTfValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs .createParallelGroup(Alignment.BASELINE) .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))) .addGap(107))); 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.LEADING) .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).addComponent( panelOutputs, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addGap(13) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 85, 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, 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(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Roz Est\u00E1tico"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("Roz Din\u00E1mico"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("Masa"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblMudValue = new JLabel("0.1"); lblMudValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMValue = new JLabel("10"); lblMValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMueValue = new JLabel("0.4"); lblMueValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderMue = new JSlider(); sliderMue.setMinimum(15); sliderMue.setMaximum(80); sliderMue.setMinorTickSpacing(1); sliderMue.setValue(40); sliderMue.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderMud = new JSlider(); sliderMud.setMinimum(5); sliderMud.setMaximum(15); sliderMud.setMinorTickSpacing(1); sliderMud.setValue(10); sliderMud.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderIM = new JSlider(); sliderIM.setMinimum(1); sliderIM.setMaximum(20); sliderIM.setValue(10); sliderIM.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblI4 = new JLabel("\u00C1ngulo"); lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblZValue = new JLabel("45\u00BA"); lblZValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderZ = new JSlider(); sliderZ.setMinimum(20); sliderZ.setMaximum(60); sliderZ.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderZ.setValue(45); sliderZ.setMinorTickSpacing(1); btnCilindro = new JButton(new ImageIcon(loadImage(cilindro))); btnCilindro.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { type = CILINDRO; btnCilindro.setEnabled(false); btnEsfera.setEnabled(true); btnCubo.setEnabled(true); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage1, xPulley, yPulley); updatePanels(); repaint(); } }); btnEsfera = new JButton(new ImageIcon(loadImage(esfera))); btnEsfera.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { type = ESFERA; btnCilindro.setEnabled(true); btnEsfera.setEnabled(false); btnCubo.setEnabled(true); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage2, xPulley, yPulley); updatePanels(); repaint(); } }); btnCubo = new JButton(new ImageIcon(loadImage(cubo))); btnCubo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { type = CUBO; btnCilindro.setEnabled(true); btnEsfera.setEnabled(true); btnCubo.setEnabled(false); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage3, xPulley, yPulley); updatePanels(); 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().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(lblMueValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblMudValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderMue, 0, 0, Short.MAX_VALUE) .addComponent(sliderMud, 0, 0, Short.MAX_VALUE).addComponent( sliderIM, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(lblZValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderZ, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGap(19)) .addGroup(Alignment.LEADING, gl_panelInputs.createSequentialGroup().addGap(35) .addComponent(btnCilindro, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(btnEsfera, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(btnCubo, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addContainerGap(42, 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.createParallelGroup(Alignment.BASELINE) .addComponent(LabelI1).addComponent(lblMueValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderMue, 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(lblMudValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderMud, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderIM, 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(lblZValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderZ, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(36) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(btnCubo, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addComponent(btnEsfera, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addComponent(btnCilindro, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); 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, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 696, GroupLayout.PREFERRED_SIZE) .addContainerGap(149, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) .addComponent(panel_visualizar, Alignment.TRAILING, 0, 0, Short.MAX_VALUE) .addComponent(panel_control, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 568, Short.MAX_VALUE)) .addContainerGap())); JPanel panel = new JPanel(); panelGrafica = new JPanelGrafica(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 686, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)); panel.setLayout(gl_panel); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 414, GroupLayout.PREFERRED_SIZE) .addContainerGap(272, Short.MAX_VALUE))); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.DEFAULT_SIZE, 546, Short.MAX_VALUE).addContainerGap())); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }
From source file:at.becast.youploader.gui.FrmMain.java
public void initQueuetab() { JScrollPane TabQueues = new JScrollPane(); QueuePanel = new JPanel(); TabQueues.setViewportView(QueuePanel); QueuePanel.setLayout(new MigLayout("", "[875px,grow,fill]", "[][][][]")); JPanel buttonPanel = new JPanel(); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.fill = GridBagConstraints.BOTH; gbc_panel_2.gridx = 0;//w ww . ja va 2 s .co m gbc_panel_2.gridy = 1; buttonPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(39dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(92dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(46dlu;min)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(22dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(0dlu;default)"), })); JButton btnStart = new JButton(LANG.getString("frmMain.start")); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startUploads(); } }); JLabel lblAfterUploadsFinish = new JLabel(LANG.getString("frmMain.afterfinish")); buttonPanel.add(lblAfterUploadsFinish, "10, 2, 7, 1"); buttonPanel.add(btnStart, "2, 4"); JButton btnStop = new JButton(LANG.getString("frmMain.stop")); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UploadMgr.stop(); } }); buttonPanel.add(btnStop, "6, 4"); cmbAfterFinish = new JComboBox<Object>(); cmbAfterFinish.setModel(new DefaultComboBoxModel<Object>(new String[] { LANG.getString("frmMain.afterfinish.donothing"), LANG.getString("frmMain.afterfinish.suspend"), LANG.getString("frmMain.afterfinish.shutdown") })); buttonPanel.add(cmbAfterFinish, "10, 4, 7, 1, fill, default"); JLabel lblUploads = new JLabel(LANG.getString("frmMain.uploads") + ":"); buttonPanel.add(lblUploads, "18, 4, right, fill"); JSlider slider = new JSlider(); slider.setPaintTicks(true); slider.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { JSlider s = (JSlider) evt.getSource(); UploadMgr.setUploadlimit(s.getValue()); } }); slider.setMajorTickSpacing(1); slider.setMinorTickSpacing(1); slider.setMinimum(1); slider.setMaximum(5); slider.setValue(1); slider.setSnapToTicks(true); slider.setPaintLabels(true); buttonPanel.add(slider, "20, 4, fill, fill"); JLabel lblUploadSpeed = new JLabel(LANG.getString("frmMain.uploadspeed") + ":"); lblUploadSpeed.setHorizontalAlignment(SwingConstants.TRAILING); buttonPanel.add(lblUploadSpeed, "24, 4"); spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(10))); spinner.setEditor(new SpeedValuesSpinnerEditor(spinner)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner s = (JSpinner) e.getSource(); speed = Integer.parseInt(s.getValue().toString()); Main.s.put("speed", String.valueOf(speed)); UploadMgr.setLimit(speed); } }); spinner.setValue(speed); buttonPanel.add(spinner, "26, 4"); JLabel lblKbps = new JLabel("kbps"); buttonPanel.add(lblKbps, "28, 4"); JPanel TabQueue = new JPanel(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.Queue"), null, TabQueue, null); TabQueue.setLayout(new BorderLayout(0, 0)); TabQueue.add(buttonPanel, BorderLayout.SOUTH); TabQueue.add(TabQueues, BorderLayout.CENTER); }
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)/*from w w w . ja v a2 s .c o 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: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(/*ww w.j a v a 2 s. co 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: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 va 2 s .c o m*/ .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: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 w ww. ja va 2 s . c om*/ 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); }
From source file:SplineInterpolatorTest.java
protected void addUiToPanel(JPanel panel) { JSlider slider = new JSlider(); slider.addChangeListener(this); panel.add(slider);/*ww w.j a va2 s.c om*/ m_Button = new JButton("Auto"); m_Button.addChangeListener(this); panel.add(m_Button); }