List of usage examples for javax.swing JButton setBounds
public void setBounds(int x, int y, int width, int height)
From source file:app.RunApp.java
/** * Creates multiple datasets table of metrics and its buttons * //from w ww . j ava 2s.c om * @param jtable Table with metrics * @param jpanel Panel * @param buttonAll "All" button * @param buttonNone "None" button * @param buttonInvert "Invert" button * @param buttonCalculate "Calculate" button * @param buttonSave "Save" button * @param posx Position X * @param posy Position Y * @param width Width * @param height Height */ private void createMultiMetricsTable(final JTable jtable, JPanel jpanel, JButton buttonAll, JButton buttonNone, JButton buttonInvert, JButton buttonCalculate, JButton buttonSave, int posx, int posy, int width, int height) { createJTableMetricsMultipleDatasets(jtable, jpanel, MetricUtils.getRowDataMulti(), posx, posy, width, height); //button All buttonAll = new JButton("All"); buttonAll.setBounds(posx, posy + height + 5, 80, 20); buttonAll.setToolTipText("Select all metrics"); buttonAll.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonAllActionPerformedMulti(evt, jtable); } }); jpanel.add(buttonAll); //button None buttonNone = new JButton("None"); buttonNone.setToolTipText("Deselect all metrics"); buttonNone.setBounds(posx + 90, posy + height + 5, 80, 20); buttonNone.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonNoneActionPerformedMulti(evt, jtable); } }); jpanel.add(buttonNone); //button Invert buttonInvert = new JButton("Invert"); buttonInvert.setToolTipText("Invert selection"); buttonInvert.setBounds(posx + 180, posy + height + 5, 80, 20); buttonInvert.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonInvertActionPerformedMulti(evt, jtable); } }); jpanel.add(buttonInvert); //button Calculate buttonCalculate = new JButton("Calculate"); buttonCalculate.setBounds(posx + 320, posy + height + 5, 95, 20); buttonCalculate.setToolTipText("Calculate selected metrics"); buttonCalculate.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { progressFrame.setVisible(true); progressFrame.repaint(); progressBar.setIndeterminate(false); new Thread(new Runnable() { @Override public void run() { // do the long-running work here buttonCalculateActionPerformedMulti(evt, jtable); // at the end: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { progressBar.setIndeterminate(false); progressFrame.setVisible(false); progressFrame.repaint(); JOptionPane.showMessageDialog(null, "Metrics have been calculated succesfully.", "Successful", JOptionPane.INFORMATION_MESSAGE); }//run }); //invokeLater } }).start(); //Thread } }); jpanel.add(buttonCalculate); //button Save buttonSave = new JButton("Save"); buttonSave.setBounds(posx + 425, posy + height + 5, 80, 20); buttonSave.setToolTipText("Save selected metrics in a file"); buttonSave.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { try { buttonSaveActionPerformedMulti(evt, jtable); } catch (IOException ex) { Logger.getLogger(RunApp.class.getName()).log(Level.SEVERE, null, ex); } } }); jpanel.add(buttonSave); }
From source file:app.RunApp.java
/** * Creates table of metrics and its buttons * /*from www . j a v a 2 s . c o m*/ * @param jtable Table with metrics * @param jpanel Panel * @param buttonAll "All" button * @param buttonNone "None" button * @param buttonInvert "Invert" button * @param buttonCalculate "Calculate" button * @param buttonSave "Save" button * @param buttonClear "Clear" button * @param posx Position x * @param posy Position Y * @param width Width * @param height Height */ private void createMetricsTable(final JTable jtable, JPanel jpanel, JButton buttonAll, JButton buttonNone, JButton buttonInvert, JButton buttonCalculate, JButton buttonSave, JButton buttonClear, int posx, int posy, int width, int height) { createJTableMetricsPrincipal(jtable, jpanel, MetricUtils.getRowData(), posx, posy, width, height); //button All buttonAll = new JButton("All"); buttonAll.setBounds(posx, posy + height + 5, 80, 20); buttonAll.setToolTipText("Select all metrics"); buttonAll.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonAllActionPerformedPrincipal(evt, jtable); } }); jpanel.add(buttonAll); //button None buttonNone = new JButton("None"); buttonNone.setToolTipText("Deselect all metrics"); buttonNone.setBounds(posx + 90, posy + height + 5, 80, 20); buttonNone.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonNoneActionPerformedPrincipal(evt, jtable); } }); jpanel.add(buttonNone); //button Invert buttonInvert = new JButton("Invert"); buttonInvert.setToolTipText("Invert selection"); buttonInvert.setBounds(posx + 180, posy + height + 5, 80, 20); buttonInvert.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonInvertActionButtonPerformed(evt, jtable); } }); jpanel.add(buttonInvert); //button Clear buttonClear = new JButton("Clear"); buttonClear.setToolTipText("Clear selection and metric values"); buttonClear.setBounds(posx + 270, posy + height + 5, 80, 20); buttonClear.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { buttonClearActionPerformedPrincipal(evt, jtable); } }); jpanel.add(buttonClear); //button Calculate buttonCalculate = new JButton("Calculate"); buttonCalculate.setBounds(posx + 590, posy + height + 5, 95, 25); buttonCalculate.setToolTipText("Calculate selected metrics"); buttonCalculate.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { progressBar.setIndeterminate(false); progressFrame.setVisible(true); progressFrame.repaint(); new Thread(new Runnable() { @Override public void run() { // do the long-running work here buttonCalculateActionPerformedPrincipal(evt, jtable); // at the end: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { progressBar.setIndeterminate(false); progressFrame.setVisible(false); progressFrame.repaint(); }//run }); //invokeLater } }).start(); //Thread } //actionPerformed });//ActionListener jpanel.add(buttonCalculate); //button Save buttonSave = new JButton("Save"); buttonSave.setBounds(posx + 695, posy + height + 5, 80, 25); buttonSave.setToolTipText("Save selected metrics in a file"); buttonSave.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { try { buttonSaveActionPerformedPrincipal(evt, jtable); } catch (IOException ex) { Logger.getLogger(RunApp.class.getName()).log(Level.SEVERE, null, ex); } } }); jpanel.add(buttonSave); }
From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJReferenceEditor.java
public CFJReferenceEditor(Action pickReference, Action viewReference) { super();//from www .j a va 2 s . co m final String S_ProcName = "construct"; if (pickReference == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "pickReference"); } if (viewReference == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "viewReference"); } actionPickReference = pickReference; actionPickReference.putValue(Action.NAME, null); actionPickReference.putValue(Action.SMALL_ICON, getPickIcon()); actionViewReference = viewReference; actionViewReference.putValue(Action.NAME, null); actionViewReference.putValue(Action.SMALL_ICON, getViewIcon()); referencedObject = null; JTextField textField = getTextFieldQualifiedName(); add(textField); textField.setBounds(0, 0, 100, 25); JButton button = getButtonPickReference(); add(button); button.setBounds(100, 0, 25, 25); button = getButtonViewReference(); add(button); button.setBounds(125, 0, 25, 25); Dimension min = new Dimension(150, 25); this.setMinimumSize(min); }
From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJReferenceEditor.java
public void doLayout() { Dimension sz = getSize();// w ww . ja va 2 s . com int y; if (sz.height > 25) { y = (sz.height - 25) / 2; } else { y = 0; } JTextField textField = getTextFieldQualifiedName(); textField.setBounds(0, y, sz.width - 50, 25); JButton button = getButtonPickReference(); button.setBounds(sz.width - 50, y, 25, 25); button = getButtonViewReference(); button.setBounds(sz.width - 25, y, 25, 25); }
From source file:org.coronastreet.gpxconverter.AccountManager.java
public AccountManager(MainWindow window) { setTitle("Account Settings"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(100, 100, 450, 199);/*from ww w.j a v a2 s . c o m*/ frmAccounts = new JPanel(); frmAccounts.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(frmAccounts); frmAccounts.setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(5, 5, 424, 118); frmAccounts.add(tabbedPane); JPanel stravaPanel = new JPanel(); stravaPanel.setLayout(null); tabbedPane.addTab("Strava", stravaPanel); strava_username = new JTextField(); strava_username.setBounds(79, 11, 235, 20); stravaPanel.add(strava_username); strava_username.setColumns(10); JLabel lblUsername = new JLabel("Username:"); lblUsername.setBounds(10, 14, 69, 14); stravaPanel.add(lblUsername); JLabel lblPassword = new JLabel("Password:"); lblPassword.setBounds(10, 45, 69, 14); stravaPanel.add(lblPassword); strava_password = new JPasswordField(); strava_password.setColumns(10); strava_password.setBounds(79, 42, 235, 20); stravaPanel.add(strava_password); JPanel rwgpsPanel = new JPanel(); rwgpsPanel.setLayout(null); tabbedPane.addTab("RideWithGPS", rwgpsPanel); JLabel label = new JLabel("Username:"); label.setBounds(10, 14, 69, 14); rwgpsPanel.add(label); rwgps_username = new JTextField(); rwgps_username.setColumns(10); rwgps_username.setBounds(79, 11, 235, 20); rwgpsPanel.add(rwgps_username); rwgps_password = new JPasswordField(); rwgps_password.setColumns(10); rwgps_password.setBounds(79, 42, 235, 20); rwgpsPanel.add(rwgps_password); JLabel label_1 = new JLabel("Password:"); label_1.setBounds(10, 45, 69, 14); rwgpsPanel.add(label_1); JPanel garminPanel = new JPanel(); garminPanel.setLayout(null); tabbedPane.addTab("Garmin Connect", garminPanel); JLabel label_2 = new JLabel("Username:"); label_2.setBounds(10, 14, 69, 14); garminPanel.add(label_2); garmin_username = new JTextField(); garmin_username.setColumns(10); garmin_username.setBounds(79, 11, 235, 20); garminPanel.add(garmin_username); garmin_password = new JPasswordField(); garmin_password.setColumns(10); garmin_password.setBounds(79, 42, 235, 20); garminPanel.add(garmin_password); JLabel label_3 = new JLabel("Password:"); label_3.setBounds(10, 45, 69, 14); garminPanel.add(label_3); loadAccountPrefs(); JButton btnSave = new JButton("SAVE"); btnSave.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveAccountInfo(); } }); btnSave.setBounds(106, 127, 89, 23); frmAccounts.add(btnSave); JButton btnCancel = new JButton("CANCEL"); btnCancel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { cancel(); } }); btnCancel.setBounds(242, 127, 89, 23); frmAccounts.add(btnCancel); }
From source file:org.eclipse.om2m.ipe.sample.gui.GUI.java
/** * Creates the frame.//from ww w .ja v a2 s .c o m */ public GUI() { setLocationByPlatform(true); setVisible(false); setResizable(false); setTitle("Sample Simulated IPE"); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570); contentPanel = new JPanel(); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPanel); contentPanel.setLayout(null); // Lamp0 Switcher0 JPanel panel_Lamp0 = new JPanel(); panel_Lamp0.setBounds(10, 5, 319, 260); contentPanel.add(panel_Lamp0); panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp0.setLayout(null); LABEL_LAMP_0.setIcon(iconLampOFF); LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_0.setBounds(10, 9, 149, 240); panel_Lamp0.add(LABEL_LAMP_0); // Lamp0 Switch Button JButton button_Lamp0 = new JButton(); button_Lamp0.setOpaque(false); button_Lamp0.setPressedIcon(iconButtonON); button_Lamp0.setIcon(iconButtonOFF); button_Lamp0.setBounds(187, 44, 122, 155); panel_Lamp0.add(button_Lamp0); button_Lamp0.setMinimumSize(new Dimension(30, 23)); button_Lamp0.setMaximumSize(new Dimension(30, 23)); button_Lamp0.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher0 = new JLabel("Switch LAMP_0"); labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher0.setFocusCycleRoot(true); labelSwitcher0.setBorder(null); labelSwitcher0.setAutoscrolls(true); labelSwitcher0.setBounds(187, 199, 118, 29); panel_Lamp0.add(labelSwitcher0); // Listener for Lamp0 Switch Button button_Lamp0.addActionListener(new java.awt.event.ActionListener() { // Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp0 State new Thread() { public void run() { // Send switch request to switch lamp0 state SampleMonitor.switchLamp(LAMP_0); } }.start(); } }); // Lamp1 Switcher 1 JPanel panel_Lamp1 = new JPanel(); panel_Lamp1.setBounds(10, 271, 319, 260); contentPanel.add(panel_Lamp1); panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp1.setLayout(null); LABEL_LAMP_1.setIcon(iconLampOFF); LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_1.setBounds(10, 9, 154, 240); panel_Lamp1.add(LABEL_LAMP_1); // Lamp1 Switch Button JButton button_Lamp1 = new JButton(); button_Lamp1.setOpaque(false); button_Lamp1.setPressedIcon(iconButtonON); button_Lamp1.setIcon(iconButtonOFF); button_Lamp1.setBounds(187, 44, 122, 156); panel_Lamp1.add(button_Lamp1); button_Lamp1.setMinimumSize(new Dimension(30, 23)); button_Lamp1.setMaximumSize(new Dimension(30, 23)); button_Lamp1.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher1 = new JLabel("Switch LAMP_1"); labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher1.setFocusCycleRoot(true); labelSwitcher1.setBorder(null); labelSwitcher1.setAutoscrolls(true); labelSwitcher1.setBounds(187, 199, 118, 29); panel_Lamp1.add(labelSwitcher1); // Listener for Lamp1 Switch Button button_Lamp1.addActionListener(new java.awt.event.ActionListener() { //Switch Button clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp1 State new Thread() { public void run() { // Send switch request to switch lamp1 state SampleMonitor.switchLamp(LAMP_1); } }.start(); } }); // Switcher All lamps JButton buttonAllLamp = new JButton(); buttonAllLamp.setOpaque(false); buttonAllLamp.setPressedIcon(iconButtonON); buttonAllLamp.setIcon(iconButtonOFF); buttonAllLamp.setBounds(339, 190, 145, 168); contentPanel.add(buttonAllLamp); buttonAllLamp.setMinimumSize(new Dimension(30, 23)); buttonAllLamp.setMaximumSize(new Dimension(30, 23)); buttonAllLamp.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitchAll = new JLabel("Switch All"); labelSwitchAll.setAutoscrolls(true); labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitchAll.setFocusCycleRoot(true); labelSwitchAll.setBorder(null); labelSwitchAll.setBounds(371, 369, 85, 29); contentPanel.add(labelSwitchAll); // Listener of Switch all Button buttonAllLamp.addActionListener(new java.awt.event.ActionListener() { // Switch Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change all lamps states new Thread() { public void run() { // Send switch all request to create a content with the current State SampleMonitor.switchAll(); } }.start(); } }); lampObserver = new SampleModel.LampObserver() { @Override public void onLampStateChange(String lampId, boolean state) { setLabel(lampId, state); } }; SampleModel.addObserver(lampObserver); }
From source file:org.eclipse.om2m.ipu.sample.GUI.java
/** * Creates the frame./*from ww w . ja va 2 s. co m*/ */ public GUI() { setLocationByPlatform(true); setResizable(false); setTitle("Sample Simulated IPU"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570); contentPanel = new JPanel(); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPanel); contentPanel.setLayout(null); // Lamp0 Switcher0 JPanel panel_Lamp0 = new JPanel(); panel_Lamp0.setBounds(10, 5, 319, 260); contentPanel.add(panel_Lamp0); panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp0.setLayout(null); LABEL_LAMP_0.setIcon(iconLampOFF); LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_0.setBounds(10, 9, 149, 240); panel_Lamp0.add(LABEL_LAMP_0); // Lamp0 Switch Button JButton button_Lamp0 = new JButton(); button_Lamp0.setOpaque(false); button_Lamp0.setPressedIcon(iconButtonON); button_Lamp0.setIcon(iconButtonOFF); button_Lamp0.setBounds(187, 44, 122, 155); panel_Lamp0.add(button_Lamp0); button_Lamp0.setMinimumSize(new Dimension(30, 23)); button_Lamp0.setMaximumSize(new Dimension(30, 23)); button_Lamp0.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher0 = new JLabel("Switch LAMP_0"); labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher0.setFocusCycleRoot(true); labelSwitcher0.setBorder(null); labelSwitcher0.setAutoscrolls(true); labelSwitcher0.setBounds(187, 199, 118, 29); panel_Lamp0.add(labelSwitcher0); // Listener for Lamp0 Switch Button button_Lamp0.addActionListener(new java.awt.event.ActionListener() { // Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp0 State new Thread() { public void run() { // Send switch request to switch lamp0 state Switchs.switchLamp(LAMP_0, !SampleMonitor.LAMPS.get(LAMP_0).getState()); } }.start(); } }); // Lamp1 Switcher 1 JPanel panel_Lamp1 = new JPanel(); panel_Lamp1.setBounds(10, 271, 319, 260); contentPanel.add(panel_Lamp1); panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp1.setLayout(null); LABEL_LAMP_1.setIcon(iconLampOFF); LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_1.setBounds(10, 9, 154, 240); panel_Lamp1.add(LABEL_LAMP_1); // Lamp1 Switch Button JButton button_Lamp1 = new JButton(); button_Lamp1.setOpaque(false); button_Lamp1.setPressedIcon(iconButtonON); button_Lamp1.setIcon(iconButtonOFF); button_Lamp1.setBounds(187, 44, 122, 156); panel_Lamp1.add(button_Lamp1); button_Lamp1.setMinimumSize(new Dimension(30, 23)); button_Lamp1.setMaximumSize(new Dimension(30, 23)); button_Lamp1.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher1 = new JLabel("Switch LAMP_1"); labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher1.setFocusCycleRoot(true); labelSwitcher1.setBorder(null); labelSwitcher1.setAutoscrolls(true); labelSwitcher1.setBounds(187, 199, 118, 29); panel_Lamp1.add(labelSwitcher1); // Listener for Lamp1 Switch Button button_Lamp1.addActionListener(new java.awt.event.ActionListener() { //Switch Button clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp1 State new Thread() { public void run() { // Send switch request to switch lamp1 state Switchs.switchLamp(LAMP_1, !SampleMonitor.LAMPS.get(LAMP_1).getState()); } }.start(); } }); // Switcher All lamps JButton buttonAllLamp = new JButton(); buttonAllLamp.setOpaque(false); buttonAllLamp.setPressedIcon(iconButtonON); buttonAllLamp.setIcon(iconButtonOFF); buttonAllLamp.setBounds(339, 190, 145, 168); contentPanel.add(buttonAllLamp); buttonAllLamp.setMinimumSize(new Dimension(30, 23)); buttonAllLamp.setMaximumSize(new Dimension(30, 23)); buttonAllLamp.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitchAll = new JLabel("Switch All"); labelSwitchAll.setAutoscrolls(true); labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitchAll.setFocusCycleRoot(true); labelSwitchAll.setBorder(null); labelSwitchAll.setBounds(371, 369, 85, 29); contentPanel.add(labelSwitchAll); // Listener of Switch all Button buttonAllLamp.addActionListener(new java.awt.event.ActionListener() { // Switch Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change all lamps states new Thread() { public void run() { // Send switch all request to create a content with the current State Switchs.switchAll(!(SampleMonitor.LAMPS.get(LAMP_0).getState() && SampleMonitor.LAMPS.get(LAMP_1).getState())); } }.start(); } }); }
From source file:org.mc.okapi.Correlation.java
/** * Create the dialog.//w w w . j a va 2 s . c o m */ public Correlation() { setTitle("Correlation"); setIconImage(Toolkit.getDefaultToolkit().getImage("src/images/ico/extra/science_32.png")); setBounds(100, 100, 450, 140); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); JLabel lblIx = new JLabel("X:"); lblIx.setBounds(110, 11, 46, 14); contentPanel.add(lblIx); JLabel lblIy = new JLabel("Y:"); lblIy.setBounds(286, 11, 46, 14); contentPanel.add(lblIy); JLabel lblX = new JLabel("X Label:"); lblX.setBounds(83, 44, 88, 14); contentPanel.add(lblX); tfX = new JTextField(); tfX.setBounds(128, 41, 104, 23); contentPanel.add(tfX); tfX.setColumns(10); JLabel lblY = new JLabel("Y Label:"); lblY.setBounds(260, 44, 82, 14); contentPanel.add(lblY); tfY = new JTextField(); tfY.setBounds(307, 41, 104, 23); contentPanel.add(tfY); tfY.setColumns(10); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double[] X = new double[data.getRowCount()]; double[] Y = new double[data.getRowCount()]; for (int i = 0; i < X.length; i++) { X[i] = Double.valueOf(datmat.getColumnElements(cbX.getSelectedIndex())[i]); } for (int i = 0; i < Y.length; i++) { Y[i] = Double.valueOf(datmat.getColumnElements(cbY.getSelectedIndex())[i]); } Plot plotxy = new Plot(X, Y, tfX.getText(), tfY.getText(), "(" + tfX.getText() + "," + tfY.getText() + ")", "Correlation", "r=" + new PearsonsCorrelation().correlation(X, Y)); plotxy.pack(); plotxy.setVisible(true); //System.out.println(Arrays.toString(datmat.getColumnElements(1))); //Runtime.getRuntime().exec("CMD /C start R CMD BATCH --no-save --no-restore --slave -f src/r/cor.R \"--args inFile='"+inFile+"' outFile='"+outPath+"/"+tfoutfile.getText()+"' iX='"+tfiX.getText()+"' iY='"+tfiY.getText()+"'\" "); //Runtime.getRuntime().exec("CMD /C start Rscript cor.R '"+inFile+"' '"+outPath+"/"+tfoutfile.getText()+"' "+tfiX.getText()+" "+tfiY.getText()); //Rsession ss = Rsession.newInstanceTry(System.out,null); //Rsession rs = Rsession.newInstanceTry(System.out,RserverConf.parse("R://localhost")); /* Rsession rs = Rsession.newInstanceTry(System.out,RserverConf.parse("R://localhost")); rs.set("df", data); //create R variable from java one rs.save(new File("save.Rdata"), "df"); //save variables in .Rdata*/ /*RConnection c; try { c = new RConnection(); double[] dataX = {1,4,5,8}; double[] dataY = {1,7,9,12}; c.assign("x", dataX); c.assign("y", dataY); //c.assign("z", datmat.getColumnElements(1)); //String[] d= c.eval("c(z)").asStrings(); //System.out.println(d[1].toString()); System.out.println(Arrays.toString(datmat.getColumnElements(1))); } catch (RserveException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } catch (REngineException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }*/ try { Thread.sleep(3000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); okButton.setBounds(175, 72, 57, 23); contentPanel.add(okButton); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dispose(); } }); cancelButton.setBounds(242, 72, 74, 23); contentPanel.add(cancelButton); cancelButton.setActionCommand("Cancel"); } cbX = new JComboBox(); cbX.setBounds(128, 8, 104, 20); contentPanel.add(cbX); cbY = new JComboBox(); cbY.setBounds(307, 8, 104, 20); contentPanel.add(cbY); }
From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WarehouseManagement.java
/** * Initialize the contents of the frame/* w ww .j a v a 2s . c o m*/ */ private void initialize() { final JTabbedPane tabbedPane; final JPanel deliveryPanel; final JLabel entryDateLabel; final JLabel entryDateLabel_1; final JLabel entryDateLabel_2; final JLabel entryDateLabel_3; final JLabel entryDateLabel_3_1; final JLabel entryDateLabel_3_2; final JPanel shipmentPanel; final JLabel entryDateLabel_3_1_1; final JLabel entryDateLabel_3_1_2; final JScrollPane scrollPane; final JButton printReportButton; final JButton saveReportButton; final JButton activateDoorButton; final JButton deactivateDoorButton; final JButton clearReportButton; final JPanel panel; final JLabel entryDateLabel_3_3; final JLabel entryDateLabel_2_1; frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); frame.setTitle("Warehouse Management"); frame.setBounds(100, 100, 1011, 625); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = new JTabbedPane(); frame.getContentPane().add(tabbedPane); deliveryPanel = new JPanel(); deliveryPanel.setLayout(null); tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null); entryDateLabel = new JLabel(); entryDateLabel.setText("Entry Date ........."); entryDateLabel.setBounds(533, 23, 117, 16); deliveryPanel.add(entryDateLabel); entryDateLabel_1 = new JLabel(); entryDateLabel_1.setText("User ID ................"); entryDateLabel_1.setBounds(10, 94, 117, 16); deliveryPanel.add(entryDateLabel_1); entryDateLabel_2 = new JLabel(); entryDateLabel_2.setText("Invoice ID ............"); entryDateLabel_2.setBounds(10, 23, 117, 16); deliveryPanel.add(entryDateLabel_2); entryDateLabel_3 = new JLabel(); entryDateLabel_3.setText("Warehouse ID...."); entryDateLabel_3.setBounds(10, 45, 117, 16); deliveryPanel.add(entryDateLabel_3); entryDateLabel_3_1 = new JLabel(); entryDateLabel_3_1.setText("Zone ID ................"); entryDateLabel_3_1.setBounds(10, 67, 117, 16); deliveryPanel.add(entryDateLabel_3_1); entryDateLabel_3_2 = new JLabel(); entryDateLabel_3_2.setText("Entry Hour ........."); entryDateLabel_3_2.setBounds(533, 45, 117, 16); deliveryPanel.add(entryDateLabel_3_2); entryDateLabel_3_1_1 = new JLabel(); entryDateLabel_3_1_1.setText("Offering Date ...."); entryDateLabel_3_1_1.setBounds(533, 70, 117, 16); deliveryPanel.add(entryDateLabel_3_1_1); entryDateLabel_3_1_2 = new JLabel(); entryDateLabel_3_1_2.setText("Offering Hour ...."); entryDateLabel_3_1_2.setBounds(533, 94, 117, 16); deliveryPanel.add(entryDateLabel_3_1_2); invoiceIDTextField = new JTextField(); invoiceIDTextField.setBounds(105, 19, 365, 20); deliveryPanel.add(invoiceIDTextField); warehouseIDTextField = new JTextField(); warehouseIDTextField.setBounds(105, 43, 365, 20); deliveryPanel.add(warehouseIDTextField); zoneIDTextField = new JTextField(); zoneIDTextField.setBounds(105, 66, 365, 20); deliveryPanel.add(zoneIDTextField); userIDTextField = new JTextField(); userIDTextField.setBounds(105, 90, 365, 20); deliveryPanel.add(userIDTextField); entryDateTextField = new JTextField(); entryDateTextField.setBounds(623, 19, 365, 20); deliveryPanel.add(entryDateTextField); entryHourTextField = new JTextField(); entryHourTextField.setBounds(623, 41, 365, 20); deliveryPanel.add(entryHourTextField); offeringDateTextField = new JTextField(); offeringDateTextField.setBounds(623, 66, 365, 20); deliveryPanel.add(offeringDateTextField); offeringHourTextField = new JTextField(); offeringHourTextField.setBounds(623, 90, 365, 20); deliveryPanel.add(offeringHourTextField); scrollPane = new JScrollPane(); scrollPane.setBounds(10, 129, 978, 355); deliveryPanel.add(scrollPane); deliveryTableModel = new DefaultTableModel();// All Clients Items deliveryTableModel.addColumn("Company"); deliveryTableModel.addColumn("Item Code"); deliveryTableModel.addColumn("Description"); deliveryTableModel.addColumn("Quantity Delivered"); deliveryTableModel.addColumn("Expected Quantity"); deliveryTableModel.addColumn("Quantity Remain"); deliveryTableModel.addColumn("Delivery Date"); deliveryTableModel.addColumn("Measurement ID"); deliveryTableModel.addColumn("Quantity"); deliveryTable = new JTable(deliveryTableModel); deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10)); deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(deliveryTable); ListSelectionModel rowSM = deliveryTable.getSelectionModel(); printReportButton = new JButton(); printReportButton.setText("Print Report"); printReportButton.setBounds(860, 520, 117, 26); deliveryPanel.add(printReportButton); saveReportButton = new JButton(); saveReportButton.setText("Save Report"); saveReportButton.setBounds(614, 520, 117, 26); deliveryPanel.add(saveReportButton); activateDoorButton = new JButton(); activateDoorButton.addMouseListener(new ActivateDoorButtonMouseListener()); activateDoorButton.setText("Activate Door"); activateDoorButton.setBounds(50, 520, 117, 26); deliveryPanel.add(activateDoorButton); deactivateDoorButton = new JButton(); deactivateDoorButton.addMouseListener(new DeactivateDoorButtonMouseListener()); deactivateDoorButton.setText("Dectivate Door"); deactivateDoorButton.setBounds(173, 520, 117, 26); deliveryPanel.add(deactivateDoorButton); clearReportButton = new JButton(); clearReportButton.addMouseListener(new ClearReportButtonMouseListener()); clearReportButton.setText("Clear Report"); clearReportButton.setBounds(737, 520, 117, 26); deliveryPanel.add(clearReportButton); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { // no rows are selected } else { selectedRow = lsm.getMinSelectionIndex(); System.out.println("selectedRow = " + selectedRow); } } }); shipmentPanel = new JPanel(); tabbedPane.addTab("Shipment", null, shipmentPanel, null); panel = new JPanel(); panel.setLayout(null); tabbedPane.addTab("Door Config", null, panel, null); aleListeningPortTextField = new JTextField(); aleListeningPortTextField.setText("9999"); aleListeningPortTextField.setBounds(172, 41, 330, 20); panel.add(aleListeningPortTextField); epcisRepositoryURLTextField = new JTextField(); epcisRepositoryURLTextField.setText("http://localhost:8080/aspire0.3.0EpcisRepository/capture"); epcisRepositoryURLTextField.setBounds(172, 65, 330, 20); panel.add(epcisRepositoryURLTextField); entryDateLabel_3_3 = new JLabel(); entryDateLabel_3_3.setText("EPCIS Rep. URL ........."); entryDateLabel_3_3.setBounds(51, 67, 117, 16); panel.add(entryDateLabel_3_3); entryDateLabel_2_1 = new JLabel(); entryDateLabel_2_1.setText("ALE Listening Port ...."); entryDateLabel_2_1.setBounds(51, 43, 117, 16); panel.add(entryDateLabel_2_1); }
From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WMS.java
/** * Initialize the contents of the frame/*from w w w .j ava2 s. c o m*/ */ private void initialize() { final JLabel entryDateLabel_2; final JLabel entryDateLabel_3_1_1; final JScrollPane scrollPane; final JButton printReportButton; final JButton saveReportButton; final JButton clearReportButton; frame = new JFrame(); frame.setResizable(false); frame.addWindowListener(new FrameWindowListener()); frame.getContentPane().setLayout(new BorderLayout()); frame.setTitle("Warehouse Management"); frame.setBounds(100, 100, 757, 625); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = new JTabbedPane(); frame.getContentPane().add(tabbedPane); deliveryTableModel = new DefaultTableModel();// All Clients Items deliveryTableModel.addColumn("Company"); deliveryTableModel.addColumn("Item Code"); deliveryTableModel.addColumn("Description"); deliveryTableModel.addColumn("Quantity Delivered"); deliveryTableModel.addColumn("Expected Quantity"); deliveryTableModel.addColumn("Quantity Remain"); deliveryTableModel.addColumn("Delivery Date"); deliveryTableModel.addColumn("Measurement ID"); deliveryInfoModel = new DefaultTableModel();// All Clients Items deliveryInfoModel.addColumn("Company"); deliveryInfoModel.addColumn("Item Code"); deliveryInfoModel.addColumn("Description"); deliveryInfoModel.addColumn("Expected Quantity"); deliveryInfoModel.addColumn("Measurement ID"); shipmentPanel = new JPanel(); shipmentPanel.setLayout(null); tabbedPane.addTab("Shipment", null, shipmentPanel, null); submitShipmentButton = new JButton(); submitShipmentButton.addActionListener(new SubmitShipmentButtonActionListener()); submitShipmentButton.setText("Submit"); submitShipmentButton.setBounds(275, 89, 112, 25); shipmentPanel.add(submitShipmentButton); final JLabel selectAvaiableInvoiceLabel = new JLabel(); selectAvaiableInvoiceLabel.setText("Select avaiable invoice to track"); selectAvaiableInvoiceLabel.setBounds(58, 26, 195, 15); shipmentPanel.add(selectAvaiableInvoiceLabel); shipmentsCb = new JComboBox(); shipmentsCb.setModel(new DefaultComboBoxModel(new String[] {})); shipmentsCb.setSelectedItem(null); shipmentsCb.addActionListener(new ShipmentsCbActionListener()); shipmentsCb.setBounds(269, 21, 382, 24); shipmentPanel.add(shipmentsCb); final JPanel panel = new JPanel(); panel.setLayout(null); panel.setBorder(new TitledBorder(null, "Shipment information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); panel.setBounds(10, 170, 722, 327); shipmentPanel.add(panel); final JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(10, 27, 702, 300); panel.add(scrollPane_1); deliveryInfo = new JTable(deliveryInfoModel); deliveryInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane_1.setViewportView(deliveryInfo); deliveryPanel = new JPanel(); deliveryPanel.setLayout(null); tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null); entryDateLabel_2 = new JLabel(); entryDateLabel_2.setText("Invoice ID "); entryDateLabel_2.setBounds(10, 23, 117, 16); deliveryPanel.add(entryDateLabel_2); entryDateLabel_3_1_1 = new JLabel(); entryDateLabel_3_1_1.setText("Offering Date"); entryDateLabel_3_1_1.setBounds(391, 25, 117, 16); deliveryPanel.add(entryDateLabel_3_1_1); invoiceIDTextField = new JTextField(); invoiceIDTextField.setEditable(false); invoiceIDTextField.setBounds(105, 21, 270, 20); deliveryPanel.add(invoiceIDTextField); offeringDateTextField = new JTextField(); offeringDateTextField.setEditable(false); offeringDateTextField.setBounds(511, 23, 230, 20); deliveryPanel.add(offeringDateTextField); scrollPane = new JScrollPane(); scrollPane.setBounds(10, 81, 731, 403); deliveryPanel.add(scrollPane); deliveryTable = new JTable(deliveryTableModel); deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10)); deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(deliveryTable); printReportButton = new JButton(); printReportButton.setText("Print Report"); printReportButton.setBounds(459, 520, 117, 26); deliveryPanel.add(printReportButton); saveReportButton = new JButton(); saveReportButton.setText("Save Report"); saveReportButton.setBounds(213, 520, 117, 26); deliveryPanel.add(saveReportButton); clearReportButton = new JButton(); clearReportButton.addMouseListener(new ClearReportButtonMouseListener()); clearReportButton.setText("Clear Report"); clearReportButton.setBounds(336, 520, 117, 26); deliveryPanel.add(clearReportButton); }