List of usage examples for javax.swing JFrame show
@Deprecated public void show()
From source file:org.jfree.chart.demo.SymbolicXYPlotDemo.java
/** * Vertically combined sample1 and sample2 and display it. * /*from w w w . j a v a 2 s. c o m*/ * @param frameTitle * the frame title. * @param data1 * the dataset 1. * @param data2 * the dataset 2. */ private static void displayXYSymbolicCombinedVertically(final String frameTitle, final XYDataset data1, final XYDataset data2) { final String title = "Pollutant Vertically Combined"; final String xAxisLabel = "Contamination and Type"; final String yAxisLabel = "Pollutant"; // combine the x symbolic values of the two data sets final String[] combinedXSymbolicValues = SampleXYSymbolicDataset .combineXSymbolicDataset((XisSymbolic) data1, (XisSymbolic) data2); // make master dataset... final CombinedDataset data = new CombinedDataset(); data.add(data1); data.add(data2); // decompose data... final XYDataset series0 = new SubSeriesDataset(data, 0); final XYDataset series1 = new SubSeriesDataset(data, 1); // common horizontal and vertical axes final SymbolicAxis hsymbolicAxis = new SymbolicAxis(xAxisLabel, combinedXSymbolicValues); final SymbolicAxis vsymbolicAxis0 = new SymbolicAxis(yAxisLabel, ((YisSymbolic) data1).getYSymbolicValues()); final SymbolicAxis vsymbolicAxis1 = new SymbolicAxis(yAxisLabel, ((YisSymbolic) data2).getYSymbolicValues()); // create the main plot... final CombinedDomainXYPlot mainPlot = new CombinedDomainXYPlot(hsymbolicAxis); // add the sub-plots... final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot0 = new XYPlot(series0, null, vsymbolicAxis0, renderer); final XYPlot subplot1 = new XYPlot(series1, null, vsymbolicAxis1, renderer); mainPlot.add(subplot0, 1); mainPlot.add(subplot1, 1); // make the chart... final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, mainPlot, true); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); // and present it in a frame... final JFrame frame = new ChartFrame(frameTitle, chart); frame.pack(); RefineryUtilities.positionFrameRandomly(frame); frame.show(); }
From source file:org.jfree.chart.demo.SymbolicYPlotDemo.java
/** * Create and display a multi XY plot with horizontal layout. * //from ww w . j a v a2 s . c o m * @param frameTitle * the frame title. * @param data1 * dataset1. * @param data2 * dataset2. */ private static void displayYSymbolicCombinedHorizontally(final String frameTitle, final SampleYSymbolicDataset data1, final SampleYSymbolicDataset data2) { final String title = "Animals Horizontally Combined"; final String xAxisLabel = "Miles"; final String yAxisLabel = null; // combine the y symbolic values of the two data sets final String[] combinedYSymbolicValues = SampleYSymbolicDataset.combineYSymbolicDataset(data1, data2); // make master dataset... final CombinedDataset data = new CombinedDataset(); data.add(data1); data.add(data2); // decompose data... final XYDataset series0 = new SubSeriesDataset(data, 0); final XYDataset series1 = new SubSeriesDataset(data, 1); final XYDataset series2 = new SubSeriesDataset(data, 2); final XYDataset series3 = new SubSeriesDataset(data, 3); final XYDataset series4 = new SubSeriesDataset(data, 4); final XYDataset series5 = new SubSeriesDataset(data, 5); final XYDataset series6 = new SubSeriesDataset(data, 6); final XYDataset series7 = new SubSeriesDataset(data, 7); // create axes... final ValueAxis valueAxis0 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis1 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis2 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis3 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis4 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis5 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis6 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis7 = new NumberAxis(xAxisLabel); final SymbolicAxis symbolicAxis = new SymbolicAxis(yAxisLabel, combinedYSymbolicValues); // make a combined plot final CombinedRangeXYPlot mainPlot = new CombinedRangeXYPlot(symbolicAxis); // add the sub-plots final XYItemRenderer renderer0 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot0 = new XYPlot(series0, valueAxis0, null, renderer0); final XYItemRenderer renderer1 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot1 = new XYPlot(series1, valueAxis1, null, renderer1); final XYItemRenderer renderer2 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot2 = new XYPlot(series2, valueAxis2, null, renderer2); final XYItemRenderer renderer3 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot3 = new XYPlot(series3, valueAxis3, null, renderer3); final XYItemRenderer renderer4 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot4 = new XYPlot(series4, valueAxis4, null, renderer4); final XYItemRenderer renderer5 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot5 = new XYPlot(series5, valueAxis5, null, renderer5); final XYItemRenderer renderer6 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot6 = new XYPlot(series6, valueAxis6, null, renderer6); final XYItemRenderer renderer7 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot7 = new XYPlot(series7, valueAxis7, null, renderer7); mainPlot.add(subplot0, 1); mainPlot.add(subplot1, 1); mainPlot.add(subplot2, 1); mainPlot.add(subplot3, 1); mainPlot.add(subplot4, 1); mainPlot.add(subplot5, 1); mainPlot.add(subplot6, 1); mainPlot.add(subplot7, 1); // make the top level JFreeChart object final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, mainPlot, true); // then customise it a little... chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); // and present it in a frame... final JFrame ySymbolicFrame = new ChartFrame(frameTitle, chart); ySymbolicFrame.pack(); RefineryUtilities.positionFrameRandomly(ySymbolicFrame); ySymbolicFrame.show(); }
From source file:jyplot.XYErrorBar.ErrorBarDemo.java
public ErrorBarDemo() { XYDataset dataset = createDataset(); JPanel chartPanel = createChartPanel(dataset); JFrame frame = new JFrame("Error Bar Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(chartPanel); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.pack();// w w w . j a v a 2s . c o m frame.setLocation((screenSize.width - frame.getWidth()) / 2, (screenSize.height - frame.getHeight()) / 2); frame.show(); }
From source file:edu.unc.LCCC.caBIG.DWD.javaCode.visualization.SetUpPlotWindow.java
public void actionPerformed(ActionEvent ae) { myAction = ae.getActionCommand();/*from w w w . j a va 2 s . c om*/ if (myAction.equalsIgnoreCase("SAVEJPAG")) { //Container content = getContentPane(); content = getContentPane(); JFrame jframe = new OpenFileDir("Open File Directory", "SAVEJPAG"); jframe.show(); /* Modified here on 5/31/2005*/ //Container content = getContentPane(); /* Component c = V4.getBottomComponent(); content.remove(c); String fileName = OpenFileDir.JPEGFileName; //System.out.println ("JPG filename in SetPlot= " +fileName); File fFile = new File (fileName); if (fFile.exists ()) { int response = JOptionPane.showConfirmDialog (null, "Overwrite existing file "+ fileName +" ??" ,"Confirm Overwrite", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.CANCEL_OPTION) { go back to reload the file return; } } saveComponentAsJPEG(content, fileName);*/ } /*else if (myAction.equalsIgnoreCase("SAVEJPAG") ) { Container content = getContentPane(); Component c = V4.getBottomComponent(); content.remove(c); String fileName = OpenFileDir.JPEGFileName; File fFile = new File (fileName); if (fFile.exists ()) { int response = JOptionPane.showConfirmDialog (null, "Overwrite existing file "+ fileName +" ??" ,"Confirm Overwrite", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.CANCEL_OPTION) { go back to reload the file return; } } saveComponentAsJPEG(content, fileName); } */ }
From source file:courseapplication.CourseApplication1.java
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed double[] xValues = data.getxValues(); double[] yValues = data.getyValues(); double step = 0.0001; double[] xValuesForGraph = prepareArray(xValues, step); double[] polinom = new double[xValuesForGraph.length]; double[] lagr = new double[xValuesForGraph.length]; XYSeries seriesFunction = new XYSeries("Function values"); XYSeries seriesLagranje = new XYSeries("Lagranje values"); XYSeries seriesPolinom = new XYSeries("Polinom values"); double[] yValuesForGraph = new double[xValuesForGraph.length]; for (int i = 0; i < yValuesForGraph.length; i++) { yValuesForGraph[i] = data.function(function, (xValuesForGraph[i])); }//from w w w. ja v a2 s.c om for (int i = 0; i < yValuesForGraph.length; i++) { polinom[i] = interpolation.polinomInterpolation(polinomResult, xValuesForGraph[i]); lagr[i] = interpolation.lagranjeInterpolation(xValues, yValues, xValuesForGraph[i]); } for (int i = 0; i < xValuesForGraph.length; i++) { seriesFunction.add(xValuesForGraph[i], yValuesForGraph[i]); seriesLagranje.add(xValuesForGraph[i], lagr[i]); seriesPolinom.add(xValuesForGraph[i], polinom[i]); } XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(seriesFunction); data.addSeries(seriesLagranje); data.addSeries(seriesPolinom); // XYDataset data = new XYSeriesCollection(seriesFunction); JFreeChart chart = ChartFactory.createXYLineChart("Function values and approximation functions", "X", "F(x)", data, PlotOrientation.VERTICAL, true, true, true); JFrame frameForGraphic = new JFrame("Graphic"); XYPlot plot = chart.getXYPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.GREEN); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesPaint(2, Color.PINK); frameForGraphic.getContentPane().add(new ChartPanel(chart)); frameForGraphic.show(); frameForGraphic.setPreferredSize(new Dimension(800, 600)); frameForGraphic.setLocationRelativeTo(null); frameForGraphic.pack(); }
From source file:ListIt.java
public ListIt() { JFrame f = new JFrame(); final PartsListModel pcm = new PartsListModel(); ListCellRenderer lcr = new MyLabelRenderer(); JList jl = new JList(pcm); jl.setCellRenderer(lcr);/*from w w w .jav a 2 s.c o m*/ ListSelectionModel lsm = jl.getSelectionModel(); lsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { String element[] = (String[]) pcm.getElementAt(e.getFirstIndex()); System.out.println(element[0] + " : " + element[1] + " : " + element[2]); } } }); JScrollPane jsp = new JScrollPane(jl); JComboBox jc = new JComboBox(pcm); jc.setRenderer(lcr); JButton jb = new JButton("Add Merchandise"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pcm.addElement(partsList[(int) (Math.random() * partsList.length)]); } }); Container c = f.getContentPane(); c.add(jsp, BorderLayout.NORTH); c.add(jc, BorderLayout.CENTER); c.add(jb, BorderLayout.SOUTH); f.setSize(250, 250); f.show(); }
From source file:TreeIt.java
public TreeIt() { JFrame f = new JFrame(); DefaultMutableTreeNode root = new DefaultMutableTreeNode("Calendar"); DefaultMutableTreeNode months = new DefaultMutableTreeNode("Months"); root.add(months);//from w ww. j av a2 s .c o m String monthLabels[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; for (int i = 0, n = monthLabels.length; i < n; i++) months.add(new DefaultMutableTreeNode(monthLabels[i])); DefaultMutableTreeNode weeks = new DefaultMutableTreeNode("Weeks"); root.add(weeks); String weekLabels[] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; for (int i = 0, n = weekLabels.length; i < n; i++) weeks.add(new DefaultMutableTreeNode(weekLabels[i])); JTree jt = new JTree(root); jt.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getPath(); System.out.println("Picked: " + path.getLastPathComponent()); Object elements[] = path.getPath(); for (int i = 0, n = elements.length; i < n; i++) { System.out.print("->" + elements[i]); } System.out.println(); } }); DefaultMutableTreeNode lastLeaf = root.getLastLeaf(); TreePath path = new TreePath(lastLeaf.getPath()); jt.setSelectionPath(path); jt.setCellRenderer(new MyCellRenderer()); JScrollPane jsp = new JScrollPane(jt); Container c = f.getContentPane(); c.add(jsp, BorderLayout.CENTER); f.setSize(250, 250); f.show(); }
From source file:com.gele.tools.wow.wdbearmanager.WDBearManager.java
public void actionPerformed(ActionEvent arg0) { JMenuItem source = (JMenuItem) (arg0.getSource()); if (source.getText().equals(MENU_ABOUT)) { JOptionPane.showMessageDialog(this, WDBearManager.VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "\n" + "Supports any WDB version\n" + "\n" + "Thanks to:\n" + "DarkMan for testing,\n" + "John for the 1.10 specs, Annunaki for helping with the header,\n" + "Andrikos for the 1.6.x WDB specs, Pyro's WDBViewer, WDDG Forum,\n" + "blizzhackers, etc etc\n\n" + "This program uses: \n" + "JGoodies from http://www.jgoodies.com/\n" + "Hypersonic SQL database 1.7.3\n" + "Apache Log4J, Xerces\n" + "Jakarta Commons Logging and CLI\n" + "Castor from ExoLab\n" + "MySQL JDBC connector 3.1.7\n" + "HTTPUNIT from Russell Gold\n" + "Jython 2.1\n" + "Refer to directory 'licenses' for more details about the software used\n" + "PLEASE:\n" + "If you like this program and find it usefull:\n" + "Please donate money to a charity oranization of your choice.\n" + "I recommend any organization that fights cancer.\n\n" + "License:\n" + "WDBearMgr is placed under the GNU GPL. \n" + "For further information, see the page :\n" + "http://www.gnu.org/copyleft/gpl.html.\n" + "See licenses/GPL_license.html\n" + "\n" + "For a different license please contact the author.", "Info " + VERSION_INFO, JOptionPane.INFORMATION_MESSAGE); return;//from ww w . jav a 2s . co m } else if (source.getText().equals(MENU_HELP)) { JFrame myFrame = new JFrame("doc/html/index.html"); //myFrame.setFont( ); URL urlHTML = null; try { JEditorPane htmlPane = new JEditorPane(); //htmlPane.setFont(sourceFont); // .out.println("/scripts/"+source.getName()+".py"); File scriptFile = new File("doc/html/index.html"); urlHTML = scriptFile.toURL();//this.getClass().getResource("/scripts/"+source.getName()+".py"); // .out.println( urlHTML ); // .out.println( urlHTML.toExternalForm() ); htmlPane.setPage(urlHTML); htmlPane.setEditable(false); JEPyperlinkListener myJEPHL = new JEPyperlinkListener(htmlPane); htmlPane.addHyperlinkListener(myJEPHL); myFrame.getContentPane().add(new JScrollPane(htmlPane)); myFrame.pack(); myFrame.setSize(640, 480); myFrame.show(); } catch (Exception ex) { JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "Could not open 'doc/html/index.html'", "Warning " + VERSION_INFO, JOptionPane.WARNING_MESSAGE); } } else if (source.getText().equals(MENU_JDOCS)) { JFrame myFrame = new JFrame("doc/javadoc/index.html"); //myFrame.setFont( ); URL urlHTML = null; try { JEditorPane htmlPane = new JEditorPane(); //htmlPane.setFont(sourceFont); // .out.println("/scripts/"+source.getName()+".py"); File scriptFile = new File("doc/javadoc/index.html"); urlHTML = scriptFile.toURL(); htmlPane.setPage(urlHTML); htmlPane.setEditable(false); JEPyperlinkListener myJEPHL = new JEPyperlinkListener(htmlPane); htmlPane.addHyperlinkListener(myJEPHL); myFrame.getContentPane().add(new JScrollPane(htmlPane)); myFrame.pack(); myFrame.setSize(640, 480); myFrame.show(); } catch (Exception ex) { JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "Could not open 'doc/javadoc/index.html'", "Warning " + VERSION_INFO, JOptionPane.WARNING_MESSAGE); } } else if (source.getText().equals(MENU_CHECKUPDATE)) { Properties dbProps = null; String filName = PROPS_CHECK_UPDATE; try { dbProps = ReadPropertiesFile.readProperties(filName); String updFile = dbProps.getProperty(KEY_UPD_FILE); if (updFile == null) { JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "Could not find update information", "Warning " + VERSION_INFO, JOptionPane.WARNING_MESSAGE); return; } String updSite = dbProps.getProperty(KEY_WDBMGR_SITE); if (updFile == null) { JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "Could not find SITE information", "Warning " + VERSION_INFO, JOptionPane.WARNING_MESSAGE); return; } URL urlUpdScript = new URL(updFile); BufferedReader in = new BufferedReader(new InputStreamReader(urlUpdScript.openStream())); String versionTXT = in.readLine(); String downloadName = in.readLine(); in.close(); if (versionTXT.equals(WDBearManager.VERSION_INFO)) { JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" + "by kizura\n" + WDBearManager.EMAIL + "\n\n" + "You are using the latest version, no updates available", "Info " + VERSION_INFO, JOptionPane.INFORMATION_MESSAGE); return; } else { // Read version.txt String versionInfo = (String) dbProps.getProperty(KEY_VERSION_INFO); URL urlversionInfo = new URL(versionInfo); BufferedReader brVInfo = new BufferedReader(new InputStreamReader(urlversionInfo.openStream())); StringBuffer sbuVInfo = new StringBuffer(); String strLine = ""; boolean foundStart = false; while ((strLine = brVInfo.readLine()) != null) { if (strLine.startsWith("---")) { break; } if (foundStart == true) { sbuVInfo.append(strLine); sbuVInfo.append("\n"); continue; } if (strLine.startsWith(versionTXT)) { foundStart = true; continue; } } brVInfo.close(); int n = JOptionPane.showConfirmDialog(this, "New version available - Please visit " + updSite + "\n\n" + versionTXT + "\n" + "\n" + "You are using version:\n" + WDBearManager.VERSION_INFO + "\n" + "\n" + "Do you want to download this version?\n\n" + "Version information:\n" + sbuVInfo.toString(), VERSION_INFO + "by kizura", JOptionPane.YES_NO_OPTION); // JOptionPane.showMessageDialog(this, VERSION_INFO + "\n" // + "by kizura\n" + WDBManager.EMAIL + "\n\n" // + "New version available - Please visit " + updSite, // "Warning " // + VERSION_INFO, JOptionPane.WARNING_MESSAGE); if (n == 0) { JFileChooser chooser = new JFileChooser(new File(".")); chooser.setDialogTitle("Please select download location"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { URL urlUpd = new URL(downloadName); BufferedInputStream bin = new BufferedInputStream(urlUpd.openStream()); System.out.println( new File(chooser.getSelectedFile(), urlUpd.getFile()).getAbsolutePath()); File thisFile = new File(chooser.getSelectedFile(), urlUpd.getFile()); BufferedOutputStream bout = new BufferedOutputStream( new FileOutputStream(thisFile)); byte[] bufFile = new byte[102400]; int bytesRead = 0; while ((bytesRead = bin.read(bufFile)) != -1) { bout.write(bufFile, 0, bytesRead); } bin.close(); bout.close(); JOptionPane.showMessageDialog(this, "Update downloaded successfully" + "\n" + "Please check '" + thisFile.getAbsolutePath() + "'", "Success " + WDBearManager.VERSION_INFO, JOptionPane.INFORMATION_MESSAGE); //String msg = WriteCSV.writeCSV(chooser.getSelectedFile(), this.items); } catch (Exception ex) { String msg = ex.getMessage(); JOptionPane.showMessageDialog(this, msg + "\n" + "Error downloading update", "Error " + WDBearManager.VERSION_INFO, JOptionPane.ERROR_MESSAGE); } } } // user selected "download" return; } } catch (Exception ex) { ex.printStackTrace(); } } else { System.exit(0); } }
From source file:TableIt.java
public TableIt() { JFrame f = new JFrame(); TableModel tm = new MyTableModel(); final JTable table = new JTable(tm); TableColumnModel tcm = table.getColumnModel(); TableColumn column = tcm.getColumn(tcm.getColumnCount() - 1); TableCellRenderer renderer = new MyTableCellRenderer(); column.setCellRenderer(renderer);/*from w w w. j a va2 s . co m*/ JButton selectionType = new JButton("Next Type"); selectionType.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean rowSet = table.getRowSelectionAllowed(); boolean colSet = table.getColumnSelectionAllowed(); boolean cellSet = table.getCellSelectionEnabled(); boolean setRow = !rowSet; boolean setCol = rowSet ^ colSet; boolean setCell = rowSet & colSet; table.setCellSelectionEnabled(setCell); table.setColumnSelectionAllowed(setCol); table.setRowSelectionAllowed(setRow); System.out.println("Row Selection Allowed? " + setRow); System.out.println("Column Selection Allowed? " + setCol); System.out.println("Cell Selection Enabled? " + setCell); table.repaint(); } }); JButton selectionMode = new JButton("Next Mode"); selectionMode.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ListSelectionModel lsm = table.getSelectionModel(); int mode = lsm.getSelectionMode(); int nextMode; String nextModeString; if (mode == ListSelectionModel.SINGLE_SELECTION) { nextMode = ListSelectionModel.SINGLE_INTERVAL_SELECTION; nextModeString = "Single Interval Selection"; } else if (mode == ListSelectionModel.SINGLE_INTERVAL_SELECTION) { nextMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION; nextModeString = "Multiple Interval Selection"; } else { nextMode = ListSelectionModel.SINGLE_SELECTION; nextModeString = "Single Selection"; } lsm.setSelectionMode(nextMode); System.out.println("Selection Mode: " + nextModeString); table.repaint(); } }); JPanel jp = new JPanel(); jp.add(selectionType); jp.add(selectionMode); JScrollPane jsp = new JScrollPane(table); Container c = f.getContentPane(); c.add(jsp, BorderLayout.CENTER); c.add(jp, BorderLayout.SOUTH); f.setSize(300, 250); f.show(); }
From source file:org.openscience.jmol.app.Jmol.java
public static Jmol getJmol(JFrame frame, int startupWidth, int startupHeight, String commandOptions) { Splash splash = null;//from w w w .j a v a2 s.c om if (haveDisplay.booleanValue()) { ImageIcon splash_image = JmolResourceHandler.getIconX("splash"); report("splash_image=" + splash_image); splash = new Splash(frame, splash_image); splash.setCursor(new Cursor(Cursor.WAIT_CURSOR)); splash.showStatus(GT._("Creating main window...")); splash.showStatus(GT._("Initializing Swing...")); } try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception exc) { System.err.println("Error loading L&F: " + exc); } screenSize = Toolkit.getDefaultToolkit().getScreenSize(); if (splash != null) splash.showStatus(GT._("Initializing Jmol...")); Jmol window = new Jmol(splash, frame, null, startupWidth, startupHeight, commandOptions); if (haveDisplay.booleanValue()) frame.show(); return window; }