List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:SuitaDetails.java
public PropPanel() { jPanel1 = new JPanel(); addpanel = new JPanel(); addpanel.setMaximumSize(new Dimension(32767, 25)); addpanel.setMinimumSize(new Dimension(0, 25)); addpanel.setPreferredSize(new Dimension(50, 25)); addpanel.setLayout(new BorderLayout()); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone(); indexpos3.add(new Integer(parent.getSubItemsNr())); Item property = new Item("", 0, -1, -1, 10, 20, indexpos3); property.setSubItemVisible(false); property.setValue(""); parent.addSubItem(property); Prop prop = new Prop(parent, property); jPanel1.remove(addpanel);// www . jav a2s . co m jPanel1.add(prop); jPanel1.add(addpanel); jPanel1.revalidate(); jPanel1.repaint(); } }); addpanel.add(add, BorderLayout.EAST); addpanel.setBackground(Color.WHITE); JScrollPane jScrollPane1 = new JScrollPane(jPanel1); jPanel1.setBackground(Color.WHITE); jScrollPane1.setBackground(Color.WHITE); jScrollPane1.setBorder(null); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)), "Properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 0, 0))); setBackground(Color.WHITE); GroupLayout propLayout = new GroupLayout(this); setLayout(propLayout); propLayout.setHorizontalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); propLayout.setVerticalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); }
From source file:com.xilinx.virtex7.MainScreen.java
private JPanel testAndStatsSecondTab() { JPanel tstats = new JPanel(); tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS)); JPanel tstats1 = new JPanel(); tstats1.setLayout(new BoxLayout(tstats1, BoxLayout.Y_AXIS)); tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""), BorderFactory.createRaisedBevelBorder())); tstats1.add(testPanelItems2());// need to change testPanelItems method. JPanel dmaInner = new JPanel(new BorderLayout()); JPanel dmaPanel = new JPanel(new BorderLayout()); dmaPanel.setBackground(new Color(130, 170, 180)); table1T2 = new MyTableModel(dummy_data, dmaColumnNames2); dmaStats1T2 = new JTable(table1T2); try {/*from ww w . j a v a 2s. com*/ dmaStats1T2.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader dmaHeader = dmaStats1T2.getTableHeader(); dmaHeader.setForeground(new Color(92, 25, 25)); dmaPanel.add(dmaHeader, BorderLayout.PAGE_START); dmaPanel.add(dmaStats1T2, BorderLayout.CENTER); dmaInner.add(dmaPanel, BorderLayout.CENTER); tstats1.add(dmaInner); tstats.add(tstats1); /*JPanel trnPanel = new JPanel(new GridLayout(1,1)); trnPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("PCIe Statistics"), BorderFactory.createRaisedBevelBorder())); JPanel trn1 = new JPanel(new FlowLayout()); trn1.add(new JLabel("Transmit (writes in Gbps): ")); trnLTXT2 = new JTextField("0.0", 5); trnLTXT2.setEditable(false); trn1.add(trnLTXT2); trn1.add(new JLabel("Receive (reads in Gbps): ")); trnLRXT2 = new JTextField("0.0", 5); trnLRXT2.setEditable(false); trn1.add(trnLRXT2); trnPanel.add(trn1); tstats.add(trnPanel);*/ JPanel tstats2 = new JPanel(); tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS)); tstats2.add(testPanelItems3()); tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""), BorderFactory.createRaisedBevelBorder())); JPanel dmaPanel1 = new JPanel(new BorderLayout()); table2T2 = new MyTableModel(dummy_data, dmaColumnNames3); dmaStats2T2 = new JTable(table2T2); try { dmaStats2T2.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader dmaHeader1 = dmaStats2T2.getTableHeader(); dmaHeader1.setForeground(new Color(92, 25, 25)); dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START); dmaPanel1.add(dmaStats2T2, BorderLayout.CENTER); tstats2.add(dmaPanel1); tstats.add(tstats2); return tstats; }
From source file:edu.ucla.stat.SOCR.chart.Chart.java
protected void initGraphPanel() { //System.out.println("initGraphPanel called"); graphPanel = new JPanel(); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); JFreeChart chart = createEmptyChart(null); //create a empty graph first chartPanel = new ChartPanel(chart, false); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y)); graphPanel.add(chartPanel);/*from w ww . jav a 2 s .co m*/ graphPanel.validate(); }
From source file:edu.ucla.stat.SOCR.analyses.gui.NormalPower.java
protected void setSelectPanel() { selectPanel.removeAll();/*from w w w. j a va 2 s .c o m*/ selectPanel.setPreferredSize(new Dimension(400, 400)); selectPanel.add(subPanel, BorderLayout.EAST); selectPanel.add(subPanel, BorderLayout.CENTER); selectPanel.add(subPanel, BorderLayout.WEST); subPanel.add(parameterPanel, BorderLayout.SOUTH); subPanel.add(hypothesisPanel, BorderLayout.CENTER); subPanel.add(choicePanel, BorderLayout.NORTH); hypothesisPanel.setBackground(Color.LIGHT_GRAY); parameterPanel.setBackground(Color.LIGHT_GRAY); choicePanel.setBackground(Color.LIGHT_GRAY); /*********** Begin Check/Choice Setting ********************/ //choicePanel.setLayout(new BoxLayout(choicePanel, BoxLayout.Y_AXIS)); choicePanel.setLayout(new BorderLayout()); choicePanel.add(checkSampleSizeBox, BorderLayout.NORTH); choicePanel.add(checkPowerBox, BorderLayout.CENTER); choicePanel.add(criticalValueBox, BorderLayout.SOUTH); /*********** End Check/Choice Setting ********************/ /*********** Begin Hypothesis Setting ********************/ h0Label = new JLabel("Null: mu = mu_0; "); hALabelPrefix = new JLabel("Alternative: mu_A "); hALabelSurfix = new JLabel(" mu_0"); h0Panel.setBackground(Color.LIGHT_GRAY); hAPanel.setBackground(Color.LIGHT_GRAY); hACheckBoxPanel.setBackground(Color.LIGHT_GRAY); hypothesisPanel.add(h0Panel, BorderLayout.CENTER); hypothesisPanel.add(hAPanel, BorderLayout.SOUTH); h0Panel.add(h0Label, BorderLayout.CENTER); hAPanel.add(hALabelPrefix, BorderLayout.WEST); hAPanel.add(hACheckBoxPanel, BorderLayout.CENTER); hAPanel.add(hALabelSurfix, BorderLayout.EAST); hACheckBoxPanel.add(checkNE, BorderLayout.CENTER); hACheckBoxPanel.add(checkLT, BorderLayout.EAST); hACheckBoxPanel.add(checkGT, BorderLayout.WEST); /*********** End Hypothesis Setting ********************/ /*********** Begin Parameter Setting *******************/ sampleSizePanel = new JPanel(); sigmaPanel = new JPanel(); mu0Panel = new JPanel(); sigmaZTestPanel = new JPanel(); mu0ZTestPanel = new JPanel(); muAPanel = new JPanel(); alphaPanel = new JPanel(); powerPanel = new JPanel(); xValuePanel = new JPanel(); sampleSizePanel.add(sampleSizeLabel, BorderLayout.WEST); sampleSizePanel.add(sampleSizeBar, BorderLayout.CENTER); sampleSizePanel.add(sampleSizeText, BorderLayout.EAST); sigmaPanel.add(sigmaLabel, BorderLayout.WEST); sigmaPanel.add(sigmaText, BorderLayout.EAST); sigmaZTestPanel.add(sigmaZTestLabel, BorderLayout.WEST); sigmaZTestPanel.add(sigmaZTestText, BorderLayout.EAST); mu0Panel.add(mu0Label, BorderLayout.WEST); mu0Panel.add(mu0Text, BorderLayout.EAST); mu0ZTestPanel.add(mu0ZTestLabel, BorderLayout.WEST); mu0ZTestPanel.add(mu0ZTestText, BorderLayout.EAST); muAPanel.add(muALabel, BorderLayout.WEST); muAPanel.add(muAText, BorderLayout.EAST); alphaPanel.add(alphaLabel, BorderLayout.WEST); alphaPanel.add(alphaCombo, BorderLayout.EAST); powerPanel.add(powerLabel, BorderLayout.WEST); powerPanel.add(powerBar, BorderLayout.CENTER); powerPanel.add(powerText, BorderLayout.EAST); xValuePanel.add(xValueLabel, BorderLayout.WEST); xValuePanel.add(xValueText, BorderLayout.EAST); parameterPanel.setLayout(new BoxLayout(parameterPanel, BoxLayout.Y_AXIS)); parameterPanel.add(sampleSizePanel); parameterPanel.add(powerPanel); parameterPanel.add(xValuePanel); parameterPanel.add(sigmaPanel); parameterPanel.add(mu0Panel); parameterPanel.add(muAPanel); parameterPanel.add(alphaPanel); parameterPanel.add(sigmaZTestPanel); parameterPanel.add(mu0ZTestPanel); parameterPanel.add(alphaPanel); parameterPanel.add(alphaPanel); hypothesisPanel.setVisible(true); sampleSizePanel.setVisible(true); powerPanel.setVisible(false); xValuePanel.setVisible(false); sigmaZTestPanel.setVisible(false); mu0ZTestPanel.setVisible(false); }
From source file:userinterface.properties.GUIGraphHandler.java
public void defineConstantsAndPlot(Expression expr, JPanel graph, String seriesName, Boolean isNewGraph, boolean is2D) { JDialog dialog;/*from www . j ava 2 s .c o m*/ JButton ok, cancel; JScrollPane scrollPane; ConstantPickerList constantList; JComboBox<String> xAxis, yAxis; //init everything dialog = new JDialog(GUIPrism.getGUI()); dialog.setTitle("Define constants and select axes"); dialog.setSize(500, 400); dialog.setLocationRelativeTo(GUIPrism.getGUI()); dialog.setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.Y_AXIS)); dialog.setModal(true); constantList = new ConstantPickerList(); scrollPane = new JScrollPane(constantList); xAxis = new JComboBox<String>(); yAxis = new JComboBox<String>(); ok = new JButton("Ok"); ok.setMnemonic('O'); cancel = new JButton("Cancel"); cancel.setMnemonic('C'); //add all components to their dedicated panels JPanel exprPanel = new JPanel(new FlowLayout()); exprPanel.setBorder(new TitledBorder("Function")); exprPanel.add(new JLabel(expr.toString())); JPanel axisPanel = new JPanel(); axisPanel.setBorder(new TitledBorder("Select axis constants")); axisPanel.setLayout(new BoxLayout(axisPanel, BoxLayout.Y_AXIS)); JPanel xAxisPanel = new JPanel(new FlowLayout()); xAxisPanel.add(new JLabel("X axis:")); xAxisPanel.add(xAxis); JPanel yAxisPanel = new JPanel(new FlowLayout()); yAxisPanel.add(new JLabel("Y axis:")); yAxisPanel.add(yAxis); axisPanel.add(xAxisPanel); axisPanel.add(yAxisPanel); JPanel constantPanel = new JPanel(new BorderLayout()); constantPanel.setBorder(new TitledBorder("Please define the following constants")); constantPanel.add(scrollPane, BorderLayout.CENTER); constantPanel.add(new ConstantHeader(), BorderLayout.NORTH); JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); bottomPanel.add(ok); bottomPanel.add(cancel); //fill the axes components for (int i = 0; i < expr.getAllConstants().size(); i++) { xAxis.addItem(expr.getAllConstants().get(i)); if (!is2D) yAxis.addItem(expr.getAllConstants().get(i)); } if (!is2D) { yAxis.setSelectedIndex(1); } //fill the constants table for (int i = 0; i < expr.getAllConstants().size(); i++) { ConstantLine line = new ConstantLine(expr.getAllConstants().get(i), TypeDouble.getInstance()); constantList.addConstant(line); if (!is2D) { if (line.getName().equals(xAxis.getSelectedItem().toString()) || line.getName().equals(yAxis.getSelectedItem().toString())) { line.doFuncEnables(false); } else { line.doFuncEnables(true); } } } //do enables if (is2D) { yAxis.setEnabled(false); } ok.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ok"); ok.getActionMap().put("ok", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { ok.doClick(); } }); cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); cancel.getActionMap().put("cancel", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { cancel.doClick(); } }); //add action listeners xAxis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (is2D) { return; } String item = xAxis.getSelectedItem().toString(); if (item.equals(yAxis.getSelectedItem().toString())) { int index = yAxis.getSelectedIndex(); if (index != yAxis.getItemCount() - 1) { yAxis.setSelectedIndex(++index); } else { yAxis.setSelectedIndex(--index); } } for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line.getName().equals(xAxis.getSelectedItem().toString()) || line.getName().equals(yAxis.getSelectedItem().toString())) { line.doFuncEnables(false); } else { line.doFuncEnables(true); } } } }); yAxis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String item = yAxis.getSelectedItem().toString(); if (item.equals(xAxis.getSelectedItem().toString())) { int index = xAxis.getSelectedIndex(); if (index != xAxis.getItemCount() - 1) { xAxis.setSelectedIndex(++index); } else { xAxis.setSelectedIndex(--index); } } for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line.getName().equals(xAxis.getSelectedItem().toString()) || line.getName().equals(yAxis.getSelectedItem().toString())) { line.doFuncEnables(false); } else { line.doFuncEnables(true); } } } }); ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { constantList.checkValid(); } catch (PrismException e2) { JOptionPane.showMessageDialog(dialog, "<html> One or more of the defined constants are invalid. <br><br> <font color=red>Error: </font>" + e2.getMessage() + "</html>", "Parse Error", JOptionPane.ERROR_MESSAGE); return; } if (is2D) { // it will always be a parametric graph in 2d case ParametricGraph pGraph = (ParametricGraph) graph; ConstantLine xAxisConstant = constantList.getConstantLine(xAxis.getSelectedItem().toString()); if (xAxisConstant == null) { //should never happen JOptionPane.showMessageDialog(dialog, "The selected axis is invalid.", "Error", JOptionPane.ERROR_MESSAGE); return; } double xStartValue = Double.parseDouble(xAxisConstant.getStartValue()); double xEndValue = Double.parseDouble(xAxisConstant.getEndValue()); double xStepValue = Double.parseDouble(xAxisConstant.getStepValue()); int seriesCount = 0; for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line.getName().equals(xAxis.getSelectedItem().toString())) { seriesCount++; } else { seriesCount += line.getTotalNumOfValues(); } } // if there will be too many series to be plotted, ask the user if they are sure they know what they are doing if (seriesCount > 10) { int res = JOptionPane.showConfirmDialog(dialog, "This configuration will create " + seriesCount + " series. Continue?", "Confirm", JOptionPane.YES_NO_OPTION); if (res == JOptionPane.NO_OPTION) { return; } } Values singleValuesGlobal = new Values(); //add the single values to a global values list for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line.getTotalNumOfValues() == 1) { double singleValue = Double.parseDouble(line.getSingleValue()); singleValuesGlobal.addValue(line.getName(), singleValue); } } // we just have one variable so we can plot directly if (constantList.getNumConstants() == 1 || singleValuesGlobal.getNumValues() == constantList.getNumConstants() - 1) { SeriesKey key = pGraph.addSeries(seriesName); pGraph.hideShape(key); pGraph.getXAxisSettings().setHeading(xAxis.getSelectedItem().toString()); pGraph.getYAxisSettings().setHeading("function"); for (double x = xStartValue; x <= xEndValue; x += xStepValue) { double ans = -1; Values vals = new Values(); vals.addValue(xAxis.getSelectedItem().toString(), x); for (int ii = 0; ii < singleValuesGlobal.getNumValues(); ii++) { try { vals.addValue(singleValuesGlobal.getName(ii), singleValuesGlobal.getDoubleValue(ii)); } catch (PrismLangException e1) { e1.printStackTrace(); } } try { ans = expr.evaluateDouble(vals); } catch (PrismLangException e1) { e1.printStackTrace(); } pGraph.addPointToSeries(key, new PrismXYDataItem(x, ans)); } if (isNewGraph) { addGraph(pGraph); } dialog.dispose(); return; } for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line == xAxisConstant || singleValuesGlobal.contains(line.getName())) { continue; } double lineStart = Double.parseDouble(line.getStartValue()); double lineEnd = Double.parseDouble(line.getEndValue()); double lineStep = Double.parseDouble(line.getStepValue()); for (double j = lineStart; j < lineEnd; j += lineStep) { SeriesKey key = pGraph.addSeries(seriesName); pGraph.hideShape(key); for (double x = xStartValue; x <= xEndValue; x += xStepValue) { double ans = -1; Values vals = new Values(); vals.addValue(xAxis.getSelectedItem().toString(), x); vals.addValue(line.getName(), j); for (int ii = 0; ii < singleValuesGlobal.getNumValues(); ii++) { try { vals.addValue(singleValuesGlobal.getName(ii), singleValuesGlobal.getDoubleValue(ii)); } catch (PrismLangException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } for (int ii = 0; ii < constantList.getNumConstants(); ii++) { if (constantList.getConstantLine(ii) == xAxisConstant || singleValuesGlobal .contains(constantList.getConstantLine(ii).getName()) || constantList.getConstantLine(ii) == line) { continue; } ConstantLine temp = constantList.getConstantLine(ii); double val = Double.parseDouble(temp.getStartValue()); vals.addValue(temp.getName(), val); } try { ans = expr.evaluateDouble(vals); } catch (PrismLangException e1) { e1.printStackTrace(); } pGraph.addPointToSeries(key, new PrismXYDataItem(x, ans)); } } } if (isNewGraph) { addGraph(graph); } } else { // this will always be a parametric graph for the 3d case ParametricGraph3D pGraph = (ParametricGraph3D) graph; //add the graph to the gui addGraph(pGraph); //Get the constants we want to put on the x and y axis ConstantLine xAxisConstant = constantList.getConstantLine(xAxis.getSelectedItem().toString()); ConstantLine yAxisConstant = constantList.getConstantLine(yAxis.getSelectedItem().toString()); //add the single values to a global values list Values singleValuesGlobal = new Values(); for (int i = 0; i < constantList.getNumConstants(); i++) { ConstantLine line = constantList.getConstantLine(i); if (line.getTotalNumOfValues() == 1) { double singleValue = Double.parseDouble(line.getSingleValue()); singleValuesGlobal.addValue(line.getName(), singleValue); } } pGraph.setGlobalValues(singleValuesGlobal); pGraph.setAxisConstants(xAxis.getSelectedItem().toString(), yAxis.getSelectedItem().toString()); pGraph.setBounds(xAxisConstant.getStartValue(), xAxisConstant.getEndValue(), yAxisConstant.getStartValue(), yAxisConstant.getEndValue()); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { //plot the graph pGraph.plot(expr.toString(), xAxis.getSelectedItem().toString(), "Function", yAxis.getSelectedItem().toString()); //calculate the sampling rates from the step sizes as given by the user int xSamples = (int) ((Double.parseDouble(xAxisConstant.getEndValue()) - Double.parseDouble(xAxisConstant.getStartValue())) / Double.parseDouble(xAxisConstant.getStepValue())); int ySamples = (int) ((Double.parseDouble(xAxisConstant.getEndValue()) - Double.parseDouble(xAxisConstant.getStartValue())) / Double.parseDouble(xAxisConstant.getStepValue())); pGraph.setSamplingRates(xSamples, ySamples); } }); } dialog.dispose(); } }); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } }); //add everything to the dialog show the dialog dialog.add(exprPanel); dialog.add(axisPanel); dialog.add(constantPanel); dialog.add(bottomPanel); dialog.setVisible(true); }
From source file:com.xilinx.virtex7.MainScreen.java
private JPanel plotPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); String[] labels0 = { "S2C0 ", "S2C1 ", "S2C2 ", "S2C3 ", "PCIe Reads " }; String[] labels1 = { "C2S0 ", "C2S1 ", "C2S2 ", "C2S3 ", "PCIe Writes " }; dma0chart = new DMABarChart("Transmit (S2C) Performance", panel1.getBackground(), labels0); dma1chart = new DMABarChart("Receive (C2S) Performance", panel1.getBackground(), labels1); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel1.setSize(new Dimension(panel1.getWidth() - 100, panel1.getHeight() - 100)); panel1.add(dma0chart.getChart("")); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); panel2.setSize(new Dimension(panel2.getWidth() - 100, panel2.getHeight() - 100)); panel2.add(dma1chart.getChart("")); panel.add(panel1);//from w ww . j av a 2s . co m panel.add(panel2); return panel; }
From source file:com.xilinx.virtex7.MainScreen.java
private JPanel pciInfo() { JPanel pciSystemPanel = new JPanel(); pciSystemPanel.setLayout(new BoxLayout(pciSystemPanel, BoxLayout.Y_AXIS)); //pciSystemPanel.setLayout(new GridLayout(2, 1)); JPanel topPanel = new JPanel(new GridLayout(1, 2)); topPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Settings"), BorderFactory.createRaisedBevelBorder())); /*JPanel sPanel = new JPanel(new FlowLayout()); sPanel.add(new JLabel("Link Speed: ")); Object[] speeds = {"2.5 Gbps","5.0 Gbps"}; final PartialDisableComboBox lspeed = new PartialDisableComboBox(); lspeed.addItems(speeds);// ww w . jav a 2 s.c o m // hack for safe exit if (di.getPCIInfo().LinkSpeed != 0 && di.getPCIInfo().LinkSpeed-1 < speeds.length){ lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed-1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed-1, false); }else{ if (di.getPCIInfo().LinkSpeed == 4){ System.out.println(di.getPCIInfo().LinkSpeed-2); // lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed-2); // lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed-2, false); }else updateLog("Invalid Link Speed", keyWord); } sPanel.add(lspeed); JButton setSpeed = new JButton("Go"); setSpeed.setToolTipText("This enables directed PCIe link speed change"); setSpeed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (lspeed.isItemEnabled(lspeed.getSelectedIndex())) { int ret = 0; if (lspeed.getSelectedIndex() == 2) ret = di.setLinkSpeed(lspeed.getSelectedIndex()+2); else ret = di.setLinkSpeed(lspeed.getSelectedIndex()+1); if (ret == 0){ //update pcie information di.get_PCIstate(); lspeed.setItemEnabled(0, true); lspeed.setItemEnabled(1, true); lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed-1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed-1, false); ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames); ptable.fireTableDataChanged(); } else{ updateLog("Unable to set Link Speed "+lspeed.getSelectedItem(), keyWord); } } } }); sPanel.add(setSpeed); // topPanel.add(sPanel); JPanel sPanel1 = new JPanel(new FlowLayout()); sPanel1.add(new JLabel("Link Width: ")); Object[] widths = {"x1","x2","x4","x8"}; final PartialDisableComboBox lwidths = new PartialDisableComboBox(); lwidths.addItems(widths); lwidths.setSelectedItem("x"+di.getPCIInfo().LinkWidth); lwidths.setItemEnabled(lwidths.getSelectedIndex(), false); sPanel1.add(lwidths); JButton setWidth = new JButton("Go"); setWidth.setToolTipText("This enables directed PCIe link width change"); setWidth.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (lwidths.isItemEnabled(lwidths.getSelectedIndex())) { int ret = di.setLinkWidth(lwidths.getSelectedIndex()+1); if (ret == 0){ //update pcie information // some times width change affect link speed so // enable the same in lspeedd also di.get_PCIstate(); lwidths.setItemEnabled(0, true); lwidths.setItemEnabled(1, true); lwidths.setItemEnabled(2, true); lwidths.setItemEnabled(3, true); lwidths.setSelectedItem("x"+di.getPCIInfo().LinkWidth); lwidths.setItemEnabled(lwidths.getSelectedIndex(), false); // some times width change affect link speed so // enable the same in lspeed also lspeed.setItemEnabled(0, true); lspeed.setItemEnabled(1, true); lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed-1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed-1, false); ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames); ptable.fireTableDataChanged(); }else { di.get_PCIstate(); int upCap = di.getPCIInfo().LinkUpCap; if (upCap == 0) updateLog("Unable to set Link Width "+lwidths.getSelectedItem()+". PCIe link not upconfigurable", keyWord); else updateLog("Unable to set Link Width "+lwidths.getSelectedItem(), keyWord); } } } }); sPanel1.add(setWidth); // topPanel.add(sPanel1); */ // pciSystemPanel.add(topPanel); JPanel panel = new JPanel(new GridLayout(1, 2)); JPanel pciPanel = new JPanel(new BorderLayout()); pciPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("PCIe Endpoint Status"), BorderFactory.createRaisedBevelBorder())); ptable = new MyTableModel(di.getPCIInfo().getPCIData(), pcieColumnNames); pcieTable = new JTable(ptable); try { pcieTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader pcieHeader = pcieTable.getTableHeader(); pcieHeader.setForeground(new Color(92, 25, 25)); pciPanel.add(pcieHeader, BorderLayout.PAGE_START); pciPanel.add(pcieTable, BorderLayout.CENTER); panel.add(pciPanel); JPanel hostPanel = new JPanel(new BorderLayout()); hostPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Host System's Initial Credits"), BorderFactory.createRaisedBevelBorder())); htable = new MyTableModel(di.getPCIInfo().getHostedData(), pcieColumnNames); hostTable = new JTable(htable); try { hostTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader hostHeader = hostTable.getTableHeader(); hostHeader.setForeground(new Color(92, 25, 25)); hostPanel.add(hostHeader, BorderLayout.PAGE_START); hostPanel.add(hostTable, BorderLayout.CENTER); panel.add(hostPanel); pciSystemPanel.add(panel); pciSystemPanel.add(dialChart(pciSystemPanel.getWidth())); return pciSystemPanel; }
From source file:Installer.java
public Installer(File targetDir) { ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel logoSplash = new JPanel(); logoSplash.setLayout(new BoxLayout(logoSplash, BoxLayout.Y_AXIS)); try {// w w w. ja va 2 s . com // Read png BufferedImage image; image = ImageIO.read(Installer.class.getResourceAsStream("logo.png")); ImageIcon icon = new ImageIcon(image); JLabel logoLabel = new JLabel(icon); logoLabel.setAlignmentX(CENTER_ALIGNMENT); logoLabel.setAlignmentY(CENTER_ALIGNMENT); logoLabel.setSize(image.getWidth(), image.getHeight()); if (!QUIET_DEV) // VIVE - hide oculus logo logoSplash.add(logoLabel); } catch (IOException e) { } catch (IllegalArgumentException e) { } userHomeDir = System.getProperty("user.home", "."); osType = System.getProperty("os.name").toLowerCase(); if (osType.contains("win")) { isWindows = true; appDataDir = System.getenv("APPDATA"); } version = "UNKNOWN"; try { InputStream ver = Installer.class.getResourceAsStream("version"); if (ver != null) { String[] tok = new BufferedReader(new InputStreamReader(ver)).readLine().split(":"); if (tok.length > 0) { jar_id = tok[0]; version = tok[1]; } } } catch (IOException e) { } // Read release notes, save to file String tmpFileName = System.getProperty("java.io.tmpdir") + releaseNotePathAddition + "Vivecraft" + version.toLowerCase() + "_release_notes.txt"; releaseNotes = new File(tmpFileName); InputStream is = Installer.class.getResourceAsStream("release_notes.txt"); if (!copyInputStreamToFile(is, releaseNotes)) { releaseNotes = null; } JLabel tag = new JLabel("Welcome! This will install Vivecraft " + version); tag.setAlignmentX(CENTER_ALIGNMENT); tag.setAlignmentY(CENTER_ALIGNMENT); logoSplash.add(tag); logoSplash.add(Box.createRigidArea(new Dimension(5, 20))); tag = new JLabel("Select path to minecraft. (The default here is almost always what you want.)"); tag.setAlignmentX(CENTER_ALIGNMENT); tag.setAlignmentY(CENTER_ALIGNMENT); logoSplash.add(tag); logoSplash.setAlignmentX(CENTER_ALIGNMENT); logoSplash.setAlignmentY(TOP_ALIGNMENT); this.add(logoSplash); JPanel entryPanel = new JPanel(); entryPanel.setLayout(new BoxLayout(entryPanel, BoxLayout.X_AXIS)); Installer.targetDir = targetDir; selectedDirText = new JTextField(); selectedDirText.setEditable(false); selectedDirText.setToolTipText("Path to minecraft"); selectedDirText.setColumns(30); entryPanel.add(selectedDirText); JButton dirSelect = new JButton(); dirSelect.setAction(new FileSelectAction()); dirSelect.setText("..."); dirSelect.setToolTipText("Select an alternative minecraft directory"); entryPanel.add(dirSelect); entryPanel.setAlignmentX(LEFT_ALIGNMENT); entryPanel.setAlignmentY(TOP_ALIGNMENT); infoLabel = new JLabel(); infoLabel.setHorizontalTextPosition(JLabel.LEFT); infoLabel.setVerticalTextPosition(JLabel.TOP); infoLabel.setAlignmentX(LEFT_ALIGNMENT); infoLabel.setAlignmentY(TOP_ALIGNMENT); infoLabel.setVisible(false); fileEntryPanel = new JPanel(); fileEntryPanel.setLayout(new BoxLayout(fileEntryPanel, BoxLayout.Y_AXIS)); fileEntryPanel.add(infoLabel); fileEntryPanel.add(entryPanel); fileEntryPanel.setAlignmentX(CENTER_ALIGNMENT); fileEntryPanel.setAlignmentY(TOP_ALIGNMENT); this.add(fileEntryPanel); this.add(Box.createVerticalStrut(5)); JPanel optPanel = new JPanel(); optPanel.setLayout(new BoxLayout(optPanel, BoxLayout.Y_AXIS)); optPanel.setAlignmentX(LEFT_ALIGNMENT); optPanel.setAlignmentY(TOP_ALIGNMENT); //Add forge options JPanel forgePanel = new JPanel(); forgePanel.setLayout(new BoxLayout(forgePanel, BoxLayout.X_AXIS)); //Create forge: no/yes buttons useForge = new JCheckBox(); AbstractAction actf = new updateActionF(); actf.putValue(AbstractAction.NAME, "Install Vivecraft with Forge " + FORGE_VERSION); useForge.setAction(actf); forgeVersion = new JComboBox(); if (!ALLOW_FORGE_INSTALL) useForge.setEnabled(false); useForge.setToolTipText( "<html>" + "If checked, installs Vivecraft with Forge support. The correct version of Forge<br>" + "(as displayed) must already be installed.<br>" + "</html>"); //Add "yes" and "which version" to the forgePanel useForge.setAlignmentX(LEFT_ALIGNMENT); forgeVersion.setAlignmentX(LEFT_ALIGNMENT); forgePanel.add(useForge); //forgePanel.add(forgeVersion); // Profile creation / update support createProfile = new JCheckBox("", true); AbstractAction actp = new updateActionP(); actp.putValue(AbstractAction.NAME, "Create Vivecraft launcher profile"); createProfile.setAction(actp); createProfile.setAlignmentX(LEFT_ALIGNMENT); createProfile.setSelected(true); createProfile.setToolTipText("<html>" + "If checked, if a Vivecraft profile doesn't already exist within the Minecraft launcher<br>" + "one is added. Then the profile is selected, and this Vivecraft version is set as the<br>" + "current version.<br>" + "</html>"); useShadersMod = new JCheckBox(); useShadersMod.setAlignmentX(LEFT_ALIGNMENT); if (!ALLOW_SHADERSMOD_INSTALL) useShadersMod.setEnabled(false); AbstractAction acts = new updateActionSM(); acts.putValue(AbstractAction.NAME, "Install Vivecraft with ShadersMod 2.3.29"); useShadersMod.setAction(acts); useShadersMod.setToolTipText("<html>" + "If checked, sets the vivecraft profile to use ShadersMod <br>" + "support." + "</html>"); useHydra = new JCheckBox("Razer Hydra support", false); useHydra.setAlignmentX(LEFT_ALIGNMENT); if (!ALLOW_HYDRA_INSTALL) useHydra.setEnabled(false); useHydra.setToolTipText("<html>" + "If checked, installs the additional Razor Hydra native library required for Razor Hydra<br>" + "support." + "</html>"); useHrtf = new JCheckBox("Enable binaural audio (Only needed once per PC)", false); useHrtf.setToolTipText("<html>" + "If checked, the installer will create the configuration file needed for OpenAL HRTF<br>" + "ear-aware sound in Minecraft (and other games).<br>" + " If the file has previously been created, you do not need to check this again.<br>" + " NOTE: Your sound card's output MUST be set to 44.1Khz.<br>" + " WARNING, will overwrite " + (isWindows ? (appDataDir + "\\alsoft.ini") : (userHomeDir + "/.alsoftrc")) + "!<br>" + " Delete the " + (isWindows ? "alsoft.ini" : "alsoftrc") + " file to disable HRTF again." + "</html>"); useHrtf.setAlignmentX(LEFT_ALIGNMENT); //Add option panels option panel forgePanel.setAlignmentX(LEFT_ALIGNMENT); //optPanel.add(forgePanel); //optPanel.add(useShadersMod); optPanel.add(createProfile); optPanel.add(useHrtf); this.add(optPanel); this.add(Box.createRigidArea(new Dimension(5, 20))); instructions = new JLabel("", SwingConstants.CENTER); instructions.setAlignmentX(CENTER_ALIGNMENT); instructions.setAlignmentY(TOP_ALIGNMENT); instructions.setForeground(Color.RED); instructions.setPreferredSize(new Dimension(20, 40)); this.add(instructions); this.add(Box.createVerticalGlue()); JLabel github = linkify("Vivecraft is open source. find it on Github", "https://github.com/jrbudda/Vivecraft_111", "Vivecraft 1.11 Github"); JLabel wiki = linkify("Vivecraft home page", "http://www.vivecraft.org", "Vivecraft Home"); JLabel donate = linkify("If you think Vivecraft is awesome, please consider donating.", "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JVBJLN5HJJS52&lc=US&item_name=jrbudda¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)", "jrbudda's Paypal"); JLabel optifine = linkify("Vivecraft includes OptiFine for performance. Consider donating to them as well.", "http://optifine.net/donate.php", "http://optifine.net/donate.php"); github.setAlignmentX(CENTER_ALIGNMENT); github.setHorizontalAlignment(SwingConstants.CENTER); wiki.setAlignmentX(CENTER_ALIGNMENT); wiki.setHorizontalAlignment(SwingConstants.CENTER); donate.setAlignmentX(CENTER_ALIGNMENT); donate.setHorizontalAlignment(SwingConstants.CENTER); optifine.setAlignmentX(CENTER_ALIGNMENT); optifine.setHorizontalAlignment(SwingConstants.CENTER); this.add(Box.createRigidArea(new Dimension(5, 20))); this.add(github); this.add(wiki); this.add(donate); this.add(optifine); this.setAlignmentX(LEFT_ALIGNMENT); updateFilePath(); updateInstructions(); }
From source file:AppearanceExplorer.java
public ColoringAttributesEditor(ColoringAttributes init) { super(BoxLayout.Y_AXIS); coloringAttr = init;//from w ww . j a v a 2s. c o m coloringAttr.getColor(color); coloringShadeModel = coloringAttr.getShadeModel(); String[] shadeNames = { "SHADE_FLAT", "SHADE_GOURAUD", "NICEST", "FASTEST" }; int[] shadeValues = { ColoringAttributes.SHADE_FLAT, ColoringAttributes.SHADE_GOURAUD, ColoringAttributes.NICEST, ColoringAttributes.FASTEST }; IntChooser shadeChooser = new IntChooser("Shade model:", shadeNames, shadeValues, coloringShadeModel); shadeChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); coloringAttr.setShadeModel(value); } }); add(shadeChooser); Color3fEditor colorEditor = new Color3fEditor("Color", color); colorEditor.addColor3fListener(new Color3fListener() { public void colorChanged(Color3fEvent event) { event.getValue(color); coloringAttr.setColor(color); } }); add(colorEditor); }
From source file:ffx.ui.ModelingPanel.java
private void loadCommand() { synchronized (this) { // Force Field X Command Element command;//w w w . jav a 2 s . c o m // Command Options NodeList options; Element option; // Option Values NodeList values; Element value; // Options may be Conditional based on previous Option values (not // always supplied) NodeList conditionalList; Element conditional; // JobPanel GUI Components that change based on command JPanel optionPanel; // Clear the previous components commandPanel.removeAll(); optionsTabbedPane.removeAll(); conditionals.clear(); String currentCommand = (String) currentCommandBox.getSelectedItem(); if (currentCommand == null) { commandPanel.validate(); commandPanel.repaint(); return; } command = null; for (int i = 0; i < commandList.getLength(); i++) { command = (Element) commandList.item(i); String name = command.getAttribute("name"); if (name.equalsIgnoreCase(currentCommand)) { break; } } int div = splitPane.getDividerLocation(); descriptTextArea.setText(currentCommand.toUpperCase() + ": " + command.getAttribute("description")); splitPane.setBottomComponent(descriptScrollPane); splitPane.setDividerLocation(div); // The "action" tells Force Field X what to do when the // command finishes commandActions = command.getAttribute("action").trim(); // The "fileType" specifies what file types this command can execute // on String string = command.getAttribute("fileType").trim(); String[] types = string.split(" +"); commandFileTypes.clear(); for (String type : types) { if (type.contains("XYZ")) { commandFileTypes.add(FileType.XYZ); } if (type.contains("INT")) { commandFileTypes.add(FileType.INT); } if (type.contains("ARC")) { commandFileTypes.add(FileType.ARC); } if (type.contains("PDB")) { commandFileTypes.add(FileType.PDB); } if (type.contains("ANY")) { commandFileTypes.add(FileType.ANY); } } // Determine what options are available for this command options = command.getElementsByTagName("Option"); int length = options.getLength(); for (int i = 0; i < length; i++) { // This Option will be enabled (isEnabled = true) unless a // Conditional disables it boolean isEnabled = true; option = (Element) options.item(i); conditionalList = option.getElementsByTagName("Conditional"); /* * Currently, there can only be 0 or 1 Conditionals per Option * There are three types of Conditionals implemented. 1.) * Conditional on a previous Option, this option may be * available 2.) Conditional on input for this option, a * sub-option may be available 3.) Conditional on the presence * of keywords, this option may be available */ if (conditionalList != null) { conditional = (Element) conditionalList.item(0); } else { conditional = null; } // Get the command line flag String flag = option.getAttribute("flag").trim(); // Get the description String optionDescript = option.getAttribute("description"); JTextArea optionTextArea = new JTextArea(" " + optionDescript.trim()); optionTextArea.setEditable(false); optionTextArea.setLineWrap(true); optionTextArea.setWrapStyleWord(true); optionTextArea.setBorder(etchedBorder); // Get the default for this Option (if one exists) String defaultOption = option.getAttribute("default"); // Option Panel optionPanel = new JPanel(new BorderLayout()); optionPanel.add(optionTextArea, BorderLayout.NORTH); String swing = option.getAttribute("gui"); JPanel optionValuesPanel = new JPanel(new FlowLayout()); optionValuesPanel.setBorder(etchedBorder); ButtonGroup bg = null; if (swing.equalsIgnoreCase("CHECKBOXES")) { // CHECKBOXES allows selection of 1 or more values from a // predefined set (Analyze, for example) values = option.getElementsByTagName("Value"); for (int j = 0; j < values.getLength(); j++) { value = (Element) values.item(j); JCheckBox jcb = new JCheckBox(value.getAttribute("name")); jcb.addMouseListener(this); jcb.setName(flag); if (defaultOption != null && jcb.getActionCommand().equalsIgnoreCase(defaultOption)) { jcb.setSelected(true); } optionValuesPanel.add(jcb); } } else if (swing.equalsIgnoreCase("TEXTFIELD")) { // TEXTFIELD takes an arbitrary String as input JTextField jtf = new JTextField(20); jtf.addMouseListener(this); jtf.setName(flag); if (defaultOption != null && defaultOption.equals("ATOMS")) { FFXSystem sys = mainPanel.getHierarchy().getActive(); if (sys != null) { jtf.setText("" + sys.getAtomList().size()); } } else if (defaultOption != null) { jtf.setText(defaultOption); } optionValuesPanel.add(jtf); } else if (swing.equalsIgnoreCase("RADIOBUTTONS")) { // RADIOBUTTONS allows one choice from a set of predifined // values bg = new ButtonGroup(); values = option.getElementsByTagName("Value"); for (int j = 0; j < values.getLength(); j++) { value = (Element) values.item(j); JRadioButton jrb = new JRadioButton(value.getAttribute("name")); jrb.addMouseListener(this); jrb.setName(flag); bg.add(jrb); if (defaultOption != null && jrb.getActionCommand().equalsIgnoreCase(defaultOption)) { jrb.setSelected(true); } optionValuesPanel.add(jrb); } } else if (swing.equalsIgnoreCase("PROTEIN")) { // Protein allows selection of amino acids for the protein // builder optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS)); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); optionValuesPanel.add(getAminoAcidPanel()); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); acidComboBox.removeAllItems(); JButton add = new JButton("Edit"); add.setActionCommand("PROTEIN"); add.addActionListener(this); add.setAlignmentX(Button.CENTER_ALIGNMENT); JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); comboPanel.add(acidTextField); comboPanel.add(add); optionValuesPanel.add(comboPanel); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); JButton remove = new JButton("Remove"); add.setMinimumSize(remove.getPreferredSize()); add.setPreferredSize(remove.getPreferredSize()); remove.setActionCommand("PROTEIN"); remove.addActionListener(this); remove.setAlignmentX(Button.CENTER_ALIGNMENT); comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); comboPanel.add(acidComboBox); comboPanel.add(remove); optionValuesPanel.add(comboPanel); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); optionValuesPanel.add(acidScrollPane); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); JButton reset = new JButton("Reset"); reset.setActionCommand("PROTEIN"); reset.addActionListener(this); reset.setAlignmentX(Button.CENTER_ALIGNMENT); optionValuesPanel.add(reset); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); acidTextArea.setText(""); acidTextField.setText(""); } else if (swing.equalsIgnoreCase("NUCLEIC")) { // Nucleic allows selection of nucleic acids for the nucleic // acid builder optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS)); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); optionValuesPanel.add(getNucleicAcidPanel()); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); acidComboBox.removeAllItems(); JButton add = new JButton("Edit"); add.setActionCommand("NUCLEIC"); add.addActionListener(this); add.setAlignmentX(Button.CENTER_ALIGNMENT); JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); comboPanel.add(acidTextField); comboPanel.add(add); optionValuesPanel.add(comboPanel); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); JButton remove = new JButton("Remove"); add.setMinimumSize(remove.getPreferredSize()); add.setPreferredSize(remove.getPreferredSize()); remove.setActionCommand("NUCLEIC"); remove.addActionListener(this); remove.setAlignmentX(Button.CENTER_ALIGNMENT); comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); comboPanel.add(acidComboBox); comboPanel.add(remove); optionValuesPanel.add(comboPanel); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); optionValuesPanel.add(acidScrollPane); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); JButton button = new JButton("Reset"); button.setActionCommand("NUCLEIC"); button.addActionListener(this); button.setAlignmentX(Button.CENTER_ALIGNMENT); optionValuesPanel.add(button); optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5))); acidTextArea.setText(""); acidTextField.setText(""); } else if (swing.equalsIgnoreCase("SYSTEMS")) { // SYSTEMS allows selection of an open system JComboBox<FFXSystem> jcb = new JComboBox<>(mainPanel.getHierarchy().getNonActiveSystems()); jcb.setSize(jcb.getMaximumSize()); jcb.addActionListener(this); optionValuesPanel.add(jcb); } // Set up a Conditional for this Option if (conditional != null) { isEnabled = false; String conditionalName = conditional.getAttribute("name"); String conditionalValues = conditional.getAttribute("value"); String cDescription = conditional.getAttribute("description"); String cpostProcess = conditional.getAttribute("postProcess"); if (conditionalName.toUpperCase().startsWith("KEYWORD")) { optionPanel.setName(conditionalName); String keywords[] = conditionalValues.split(" +"); if (activeSystem != null) { Hashtable<String, Keyword> systemKeywords = activeSystem.getKeywords(); for (String key : keywords) { if (systemKeywords.containsKey(key.toUpperCase())) { isEnabled = true; } } } } else if (conditionalName.toUpperCase().startsWith("VALUE")) { isEnabled = true; // Add listeners to the values of this option so // the conditional options can be disabled/enabled. for (int j = 0; j < optionValuesPanel.getComponentCount(); j++) { JToggleButton jtb = (JToggleButton) optionValuesPanel.getComponent(j); jtb.addActionListener(this); jtb.setActionCommand("Conditional"); } JPanel condpanel = new JPanel(); condpanel.setBorder(etchedBorder); JLabel condlabel = new JLabel(cDescription); condlabel.setEnabled(false); condlabel.setName(conditionalValues); JTextField condtext = new JTextField(10); condlabel.setLabelFor(condtext); if (cpostProcess != null) { condtext.setName(cpostProcess); } condtext.setEnabled(false); condpanel.add(condlabel); condpanel.add(condtext); conditionals.add(condlabel); optionPanel.add(condpanel, BorderLayout.SOUTH); } else if (conditionalName.toUpperCase().startsWith("REFLECTION")) { String[] condModifiers; if (conditionalValues.equalsIgnoreCase("AltLoc")) { condModifiers = activeSystem.getAltLocations(); if (condModifiers != null && condModifiers.length > 1) { isEnabled = true; bg = new ButtonGroup(); for (int j = 0; j < condModifiers.length; j++) { JRadioButton jrbmi = new JRadioButton(condModifiers[j]); jrbmi.addMouseListener(this); bg.add(jrbmi); optionValuesPanel.add(jrbmi); if (j == 0) { jrbmi.setSelected(true); } } } } else if (conditionalValues.equalsIgnoreCase("Chains")) { condModifiers = activeSystem.getChainNames(); if (condModifiers != null && condModifiers.length > 0) { isEnabled = true; for (int j = 0; j < condModifiers.length; j++) { JRadioButton jrbmi = new JRadioButton(condModifiers[j]); jrbmi.addMouseListener(this); bg.add(jrbmi); optionValuesPanel.add(jrbmi, j); } } } } } optionPanel.add(optionValuesPanel, BorderLayout.CENTER); optionPanel.setPreferredSize(optionPanel.getPreferredSize()); optionsTabbedPane.addTab(option.getAttribute("name"), optionPanel); optionsTabbedPane.setEnabledAt(optionsTabbedPane.getTabCount() - 1, isEnabled); } } optionsTabbedPane.setPreferredSize(optionsTabbedPane.getPreferredSize()); commandPanel.setLayout(borderLayout); commandPanel.add(optionsTabbedPane, BorderLayout.CENTER); commandPanel.validate(); commandPanel.repaint(); loadLogSettings(); statusLabel.setText(" " + createCommandInput()); }