List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(Action a)
From source file:com.projity.dialog.ResourceSubstitutionDialog.java
protected void initControls() { entireProject = new JRadioButton(Messages.getString("UpdateProjectDialogBox.EntireProject")); //$NON-NLS-1$ entireProject.setSelected(true);//from ww w .j a v a 2 s. c o m selectedTask = new JRadioButton(Messages.getString("UpdateProjectDialogBox.SelectedTasks")); //$NON-NLS-1$ if (!hasTasksSelected) { selectedTask.setEnabled(false); } projectOrTask = new ButtonGroup(); projectOrTask.add(entireProject); projectOrTask.add(selectedTask); rescheduleDateChooser = CalendarFactory.createDateField(); ignoreInProgress = new JCheckBox("Ignore in-progress assignments"); //$NON-NLS-1$ ignoreInProgress.setSelected(false); List resources = (List) project.getResourcePool().getResourceList().clone(); resources.add(0, null); // allow blank fromResource = new JComboBox(resources.toArray()); toResource = new JComboBox(resources.toArray()); ok.setEnabled(false); toResource.addActionListener(this); fromResource.addActionListener(this); }
From source file:com.mirth.connect.manager.ManagerDialog.java
private void initServicePanel() { servicePanel = new JPanel( new MigLayout("insets 8, novisualpadding, hidemode 3", "24[][][]", "[]12[]12[]12[]12[]")); servicePanel.setBackground(new Color(255, 255, 255)); servicePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); servicePanel.setFocusable(false);//w w w . j av a 2 s .c o m startButton = new JButton("Start"); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startButtonActionPerformed(evt); } }); startLabel = new JLabel("Starts the Mirth Connect service"); restartButton = new JButton("Restart"); restartButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { restartButtonActionPerformed(evt); } }); restartLabel = new JLabel("Restarts the Mirth Connect service"); stopButton = new JButton("Stop"); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stopButtonActionPerformed(evt); } }); stopLabel = new JLabel("Stops the Mirth Connect service"); refreshButton = new JButton("Refresh"); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { refreshButtonActionPerformed(evt); } }); refreshLabel = new JLabel("Refreshes the Mirth Connect service status"); startup = new JCheckBox("Start Mirth Connect Server Manager on system startup"); startup.setFocusable(false); startup.setToolTipText( "Starts this application when logging into the operating system. Currently only enabled for Windows."); startup.setBackground(new Color(255, 255, 255)); startup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startupActionPerformed(evt); } }); }
From source file:ca.sqlpower.swingui.object.VariablesPanel.java
/** * Default constructor for the variables panel. * @param variableHelper A helper that will be used in order to * resolve discover and resolve variables. * @param action An implementation of {@link VariableInserter} that * gets called once the variable has been created. This action will be executed * on the Swing Event Dispatch Thread./* w w w.jav a2s . co m*/ * @param varDefinition The default variable definition string. */ public VariablesPanel(SPVariableHelper variableHelper, VariableInserter action, String varDefinition) { this.variableHelper = variableHelper; this.action = action; this.generalLabel = new JLabel("General"); this.generalLabel.setFont(this.generalLabel.getFont().deriveFont(Font.BOLD)); this.pickerLabel = new JLabel("Pick a variable"); this.varNameText = new JTextField(); this.varNameText.setEditable(false); this.varNameText.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { ShowPickerAction act = new ShowPickerAction(); act.actionPerformed(null); } }); this.varPicker = new JButton(new ShowPickerAction()); this.optionsLabel = new JLabel("Options"); this.optionsLabel.setFont(this.optionsLabel.getFont().deriveFont(Font.BOLD)); this.varDefaultLabel = new JLabel("Default value"); this.varDefaultText = new JTextField(); this.varDefaultText.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { currentDefValue = varDefaultText.getText(); updateGUI(); } }); } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); this.varEditLabel = new JLabel("Customization"); this.varEditText = new JTextField(); this.varEditText.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { int carPos = varEditText.getCaretPosition(); String text = varEditText.getText().replace("$", "").replace("{", "").replace("}", ""); currentPickedVariable = SPVariableHelper.stripDefaultValue(text); if (currentPickedVariable == null) { currentPickedVariable = ""; } currentDefValue = SPVariableHelper.getDefaultValue(text); if (currentDefValue == null) { currentDefValue = ""; } if (SPVariableHelper.getNamespace(text) == null) { namespaceBox.setSelected(false); } else { namespaceBox.setSelected(true); } updateGUI(); try { varEditText.setCaretPosition(carPos); } catch (IllegalArgumentException e) { varEditText.setCaretPosition(carPos - 1); } } }); } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); this.namespaceLabel = new JLabel("Constrain to namespace"); this.namespaceBox = new JCheckBox(""); if (SPVariableHelper.getNamespace(varDefinition) != null || "".equals(varDefinition)) { this.namespaceBox.setSelected(true); } else { this.namespaceBox.setSelected(false); } this.namespaceBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateGUI(); } }); this.previewLabel = new JLabel("Preview"); this.previewLabel.setFont(this.previewLabel.getFont().deriveFont(Font.BOLD)); this.varPreviewLabel1 = new JLabel("Current value is"); this.varPreviewLabel1.setForeground(Color.GRAY); this.varPreviewLabel2 = new JLabel(); this.varPreviewLabel2.setForeground(Color.GRAY); this.panel = new JPanel(new MigLayout()); this.panel.add(this.generalLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.pickerLabel); this.panel.add(this.varNameText, "growx, wmin 275, wmax 275, gapright 0"); this.panel.add(this.varPicker, "wmax 20, hmax 20, wrap, gapleft 0"); this.panel.add(this.optionsLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varDefaultLabel); this.panel.add(this.varDefaultText, "span, wrap, wmin 300, wmax 300"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(namespaceLabel); this.panel.add(namespaceBox, "span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varEditLabel); this.panel.add(this.varEditText, "span, wmin 300, wmax 300, wrap"); this.panel.add(this.previewLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varPreviewLabel1); this.panel.add(this.varPreviewLabel2, "span, growx"); this.currentPickedVariable = varDefinition; updateGUI(); }
From source file:modnlp.capte.AlignmentInterfaceWS.java
public AlignmentInterfaceWS() { //Setup file chooser super(new BorderLayout()); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize(dim.width, dim.height); //Create the log first, because the action listeners //need to refer to it. log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false);/*from ww w . java 2 s. c o m*/ JScrollPane logScrollPane = new JScrollPane(log); //Create a file chooser fc = new JFileChooser(); //Uncomment one of the following lines to try a different //file selection mode. The first allows just directories //to be selected (and, at least in the Java look and feel, //shown). The second allows both files and directories //to be selected. If you leave these lines commented out, //then the default mode (FILES_ONLY) will be used. // //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); //Create the open button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). alignButton = new JButton("Align Texts"); alignButton.addActionListener(this); openButton = new JButton("Open Source File..."); openButton.addActionListener(this); //Create the save button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). saveButton = new JButton("Open Target File..."); saveButton.addActionListener(this); //Create two JText fields for input source and target language codes sl = new JTextField("en"); sourcel = sl.getText(); sol = new JLabel("Source"); tl = new JTextField("es"); targetl = tl.getText(); tol = new JLabel("Target"); splitButton = new JCheckBox("Splitter"); splitButton.setMnemonic(KeyEvent.VK_C); splitButton.setSelected(true); splitButton.addItemListener(this); convLine = new JCheckBox("Convert EOL"); convLine.setMnemonic(KeyEvent.VK_S); convLine.setSelected(true); convLine.addItemListener(this); sl.addActionListener(this); tl.addActionListener(this); //For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); //use FlowLayout buttonPanel.add(openButton); buttonPanel.add(saveButton); //Make another panel for the aligner button JPanel alignPanel = new JPanel(); alignPanel.add(convLine); alignPanel.add(splitButton); alignPanel.add(sol); alignPanel.add(sl); alignPanel.add(tol); alignPanel.add(tl); alignPanel.add(alignButton); //Add the buttons and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); add(alignPanel, BorderLayout.PAGE_END); }
From source file:org.imos.abos.plot.JfreeChartDemo.java
public void createAndShowGUI() { JButton autoZoom = new JButton("Auto Scale"); autoZoom.addActionListener(new ActionListener() { @Override/*from www . j av a 2 s. c o m*/ public void actionPerformed(ActionEvent e) { System.out.println("Auto Zoom"); chart.getXYPlot().getDomainAxis().setAutoRange(true); chart.getXYPlot().getRangeAxis().setAutoRange(true); } }); JButton pdfButton = new JButton("PDF"); pdfButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("PDF"); createPDF(pdfName); } }); yMax = new JTextField(10); yMax.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("yMax Set " + yMax.getText()); double max = new Double(yMax.getText()); double min = chart.getXYPlot().getRangeAxis().getRange().getLowerBound(); chart.getXYPlot().getRangeAxis().setRange(min, max); } }); yMin = new JTextField(10); yMin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("yMin Set " + yMin.getText()); double min = new Double(yMin.getText()); double max = chart.getXYPlot().getRangeAxis().getRange().getUpperBound(); chart.getXYPlot().getRangeAxis().setRange(min, max); } }); JCheckBox showPoints = new JCheckBox("Show Points"); showPoints.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.DESELECTED) { XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); } } else if (e.getStateChange() == ItemEvent.SELECTED) { XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); } } } }); final JPanel jpanel = new JPanel(); jpanel.setLayout(new BorderLayout()); jpanel.add(chartPanel, BorderLayout.CENTER); JPanel right = new JPanel(); JPanel ypmax = new JPanel(); ypmax.add(yMax); JPanel ypmin = new JPanel(); ypmin.add(yMin); right.setLayout(new BoxLayout(right, BoxLayout.PAGE_AXIS)); right.add(ypmax); right.add(ypmin); right.add(autoZoom); right.add(pdfButton); right.add(showPoints); jpanel.add(right, BorderLayout.LINE_END); setContentPane(jpanel); pack(); setLocationRelativeTo(null); setVisible(true); }
From source file:fedroot.dacs.swingdemo.DacsSingleFrameApplication.java
private JPanel createControlPanel() { JPanel settingsPanel = new JPanel(new BorderLayout()); // TODO ad the infoPanel as a listener to the loadFederation action JPanel federationPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JLabel federationUriLabel = new JLabel("Federation URI:"); federationPanel.add(federationUriLabel); federationURLTextField = new TextField(40); federationURLTextField.setEditable(true); JButton loadFederationButton = new JButton(actionMap().get("loadFederation")); federationPanel.add(federationURLTextField); federationPanel.add(loadFederationButton); JPanel jurisdictionsPanel = new JPanel(new FlowLayout()); JLabel jurisdictionsLabel = new JLabel("Jurisdictions"); jurisdictionsPanel.add(jurisdictionsLabel); JPanel modifiersPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); checkOnlyCheckBox = new JCheckBox(actionMap().get("toggleCheckOnly")); enableEventHandlingCheckBox = new JCheckBox(actionMap().get("toggleEnableEventHandling")); modifiersPanel.add(checkOnlyCheckBox); modifiersPanel.add(enableEventHandlingCheckBox); settingsPanel.add(federationPanel, BorderLayout.NORTH); settingsPanel.add(jurisdictionsPanel, BorderLayout.CENTER); settingsPanel.add(modifiersPanel, BorderLayout.SOUTH); return settingsPanel; }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI//from ww w . j av a2 s . co m * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void createGraghTab() { JPanel cntlPanel = new JPanel(); JPanel plotPanel = createGraphPlotPanel(cntlPanel); add(plotPanel, "<html><div style='text-align: center;'>C<br>h<br>a<br>r<br>t</div></html>"); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_cntlPanel.rowHeights = new int[] { 0, 0 }; gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };// w w w . ja va 2 s . co m gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets2; gbc_check.gridx = 0; gbc_check.gridy = 0; checkBoxMafRpmData = new JCheckBox("MafV/RPM"); checkBoxMafRpmData.setActionCommand("mafrpm"); checkBoxMafRpmData.addActionListener(this); cntlPanel.add(checkBoxMafRpmData, gbc_check); gbc_check.gridx++; checkBoxRunData = new JCheckBox("AFR Error"); checkBoxRunData.setActionCommand("rdata"); checkBoxRunData.addActionListener(this); cntlPanel.add(checkBoxRunData, gbc_check); gbc_check.gridx++; createGraphCommonControls(cntlPanel, gbc_check.gridx); createChart(plotPanel, Y2AxisName); createMafSmoothingPanel(plotPanel); }
From source file:loci.slim2.process.interactive.ui.DefaultDecayGraph.java
@Override public JFrame init(final JFrame parentFrame, final int bins, final double timeInc, final PixelPicker pixelPicker) { if (null == frame || !frame.isVisible() || this.bins != bins || this.timeInc != timeInc) { // save incoming parameters this.bins = bins; this.timeInc = timeInc; maxValue = timeInc * bins;//from www . j av a 2 s . c o m this.picker = pixelPicker; if (null != frame) { // delete existing frame frame.setVisible(false); frame.dispose(); } // create the combined chart final JFreeChart chart = createCombinedChart(bins, timeInc); final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true); panel.setDomainZoomable(false); panel.setRangeZoomable(false); panel.setPreferredSize(SIZE); // add start/stop vertical bar handling dataStart = transStop = null; final JXLayer<JComponent> layer = new JXLayer<JComponent>(panel); startStopDraggingUI = new StartStopDraggingUI<JComponent>(panel, decaySubPlot, this, maxValue); layer.setUI(startStopDraggingUI); // create a frame for the chart frame = new JFrame(); final Container container = frame.getContentPane(); container.setLayout(new BorderLayout()); container.add(layer, BorderLayout.CENTER); final JPanel miscPane = new JPanel(); miscPane.setLayout(new FlowLayout()); final JLabel label1 = new JLabel(CHI_SQUARE); miscPane.add(label1); chiSqTextField = new JTextField(7); chiSqTextField.setEditable(false); miscPane.add(chiSqTextField); final JLabel label2 = new JLabel(PHOTON_COUNT); miscPane.add(label2); photonTextField = new JTextField(7); photonTextField.setEditable(false); miscPane.add(photonTextField); logCheckBox = new JCheckBox(LOGARITHMIC); logCheckBox.setSelected(logarithmic); logCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { logarithmic = logCheckBox.isSelected(); NumberAxis photonAxis; if (logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } decaySubPlot.setRangeAxis(photonAxis); } }); miscPane.add(logCheckBox); container.add(miscPane, BorderLayout.SOUTH); System.out.println("size from prefs " + getSizeFromPreferences()); // _frame.setSize(getSizeFromPreferences()); // _frame.setMaximumSize(MAX_SIZE); // doesn't work; bug in Java frame.pack(); frame.setLocationRelativeTo(parentFrame); frame.setVisible(true); frame.addComponentListener(new ComponentListener() { @Override public void componentHidden(final ComponentEvent e) { } @Override public void componentMoved(final ComponentEvent e) { } @Override public void componentResized(final ComponentEvent e) { // constrain maximum size boolean resize = false; final Dimension size = frame.getSize(); System.out.println("COMPONENT RESIZED incoming size " + size); if (size.width > MAX_SIZE.width) { size.width = MAX_SIZE.width; resize = true; } if (size.height > MAX_SIZE.height) { size.height = MAX_SIZE.height; resize = true; } if (size.width < MIN_SIZE.width) { size.width = MIN_SIZE.width; resize = true; } if (size.height < MIN_SIZE.height) { size.height = MIN_SIZE.height; resize = true; } if (resize) { frame.setSize(size); } System.out.println("save resized " + resize + " size " + size); saveSizeInPreferences(size); } @Override public void componentShown(final ComponentEvent e) { } }); this.frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { if (null != picker) { // TODO ARG does not work if you use the name 'pixelPicker' // (collides with local var; this.pP won't work). picker.hideCursor(); } } }); this.frame.setSize(getSizeFromPreferences()); } return this.frame; }
From source file:edu.mit.fss.examples.visual.gui.WorldWindVisualization.java
/** * Instantiates a new world wind visualization. * * @throws OrekitException the orekit exception *///from ww w . j a va2 s . co m public WorldWindVisualization() throws OrekitException { logger.trace("Creating Orekit reference frames."); eme = ReferenceFrame.EME2000.getOrekitFrame(); itrf = ReferenceFrame.ITRF2008.getOrekitFrame(); // world wind frame is a fixed rotation from Earth inertial frame wwj = new Frame(itrf, new Transform(date, new Rotation(RotationOrder.ZXZ, 0, -Math.PI / 2, -Math.PI / 2)), "World Wind"); logger.trace("Creating World Window GL canvas and adding to panel."); wwd = new WorldWindowGLCanvas(); wwd.setModel(new BasicModel()); wwd.setPreferredSize(new Dimension(800, 600)); setLayout(new BorderLayout()); add(wwd, BorderLayout.CENTER); logger.trace("Creating and adding a renderable layer."); displayLayer = new RenderableLayer(); wwd.getModel().getLayers().add(displayLayer); logger.trace("Creating and adding a marker layer."); markerLayer = new MarkerLayer(); // allow markers above/below surface markerLayer.setOverrideMarkerElevation(false); wwd.getModel().getLayers().add(markerLayer); logger.trace("Creating and adding a sun renderable."); Vector3D position = sun.getPVCoordinates(date, wwj).getPosition(); sunShape = new Ellipsoid(wwd.getModel().getGlobe().computePositionFromPoint(convert(position)), 696000000., 696000000., 696000000.); ShapeAttributes sunAttributes = new BasicShapeAttributes(); sunAttributes.setInteriorMaterial(Material.YELLOW); sunAttributes.setInteriorOpacity(1.0); sunShape.setAttributes(sunAttributes); displayLayer.addRenderable(sunShape); logger.trace("Creating and adding a terminator."); LatLon antiSun = LatLon.fromRadians(-sunShape.getCenterPosition().getLatitude().radians, FastMath.PI + sunShape.getCenterPosition().getLongitude().radians); // set radius to a quarter Earth chord at the anti-sun position less // a small amount (100 m) to avoid graphics problems terminatorShape = new SurfaceCircle(antiSun, wwd.getModel().getGlobe().getRadiusAt(antiSun) * FastMath.PI / 2 - 100); ShapeAttributes nightAttributes = new BasicShapeAttributes(); nightAttributes.setInteriorMaterial(Material.BLACK); nightAttributes.setInteriorOpacity(0.5); terminatorShape.setAttributes(nightAttributes); displayLayer.addRenderable(terminatorShape); logger.trace("Creating and adding a panel for buttons."); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); buttonPanel.add(new JCheckBox(new AbstractAction("Inertial Frame") { private static final long serialVersionUID = 2287109397693524964L; @Override public void actionPerformed(ActionEvent e) { setInertialFrame(((JCheckBox) e.getSource()).isSelected()); } })); buttonPanel.add(new JButton(editOptionsAction)); add(buttonPanel, BorderLayout.SOUTH); logger.trace( "Creating a timer to rotate the sun renderable, " + "terminator surface circle, and stars layer."); Timer rotationTimer = new Timer(15, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { wwd.redraw(); try { BasicOrbitView wwdView; if (wwd.getView() instanceof BasicOrbitView) { wwdView = (BasicOrbitView) wwd.getView(); } else { return; } // rotate camera to simulate inertial frame if (wwd.getView().isAnimating() || !inertialFrame.get()) { // update eme datum rotationDatum = wwj.getTransformTo(eme, date) .transformPosition(convert(wwdView.getCenterPoint())); } else if (inertialFrame.get()) { Position newCenter = wwd.getModel().getGlobe().computePositionFromPoint( convert(eme.getTransformTo(wwj, date).transformPosition(rotationDatum))); // move to eme datum wwdView.setCenterPosition(newCenter); } // rotate stars layer for (Layer layer : wwd.getModel().getLayers()) { if (layer instanceof StarsLayer) { StarsLayer stars = (StarsLayer) layer; // find the EME coordinates of (0,0) Vector3D emeDatum = wwj.getTransformTo(eme, date).transformPosition(convert( wwd.getModel().getGlobe().computePointFromLocation(LatLon.fromDegrees(0, 0)))); // find the WWJ coordinates the equivalent point in ITRF Vector3D wwjDatum = itrf.getTransformTo(wwj, date).transformPosition(emeDatum); // set the longitude offset to the opposite of // the difference in longitude (i.e. from 0) stars.setLongitudeOffset(wwd.getModel().getGlobe() .computePositionFromPoint(convert(wwjDatum)).getLongitude().multiply(-1)); } } } catch (OrekitException ex) { logger.error(ex); } } }); // set initial 2-second delay for initialization rotationTimer.setInitialDelay(2000); rotationTimer.start(); }