List of usage examples for javax.swing JToolBar JToolBar
public JToolBar()
HORIZONTAL
. From source file:edu.ucla.stat.SOCR.analyses.gui.KruskalWallis.java
/**Initialize the Analysis*/ public void init() { showInput = false;/*ww w .jav a 2s .com*/ showGraph = false; showSelect = false; showVisualize = false; super.init(); analysisType = AnalysisType.TWO_INDEPENDENT_KRUSKAL_WALLIS; useInputExample = false; useLocalExample = true; useRandomExample = false; useServerExample = true; useStaticExample = TwoIndependentKruskalWalliesExamples.availableExamples; onlineDescription = "http://en.wikipedia.org/wiki/Kruskal-Wallis_one-way_analysis_of_variance"; depMax = 1; // max number of dependent var indMax = 9; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("Regression & Correlation Analysis"); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); // use the new JFreeChar function. annie che 20060312 chartFactory = new Chart(); //depLabel.setText("Variable 1"); indLabel.setText("SELECT AT LEAST TWO GROUPS:"); validate(); }
From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaOneWay.java
/**Initialize the Analysis*/ public void init() { showInput = false;//from w ww . j a v a2 s . c om showSelect = false; showVisualize = false; super.init(); analysisType = AnalysisType.ANOVA_ONE_WAY; useInputExample = false; useLocalExample = false; useRandomExample = true; useServerExample = false; useStaticExample = new boolean[] { true, true, true, true, true, false, false, false, false, false };//AnovaOneWayExamples.availableExamples; useGraph = true; onlineDescription = "http://mathworld.wolfram.com/ANOVA.html"; depMax = 1; // max number of dependent var indMax = 1; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("One Way ANOVA"); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); resetGraph(); validate(); //reset(); }
From source file:daylightchart.gui.DaylightChartGui.java
/** * Creates a new instance of a Daylight Chart main window. * * @param location//from ww w . j a va 2 s. c om * Location for a single chart window, or null for the full UI * @param slimUi * Whether to use a slim user interface */ public DaylightChartGui(final Location location, final boolean slimUi) { this.slimUi = slimUi; setIconImage(new ImageIcon(DaylightChartGui.class.getResource("/daylightchart.png")) //$NON-NLS-1$ .getImage()); setTitle("Daylight Chart"); //$NON-NLS-1$ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (location == null) { // Create basic UI locationsTabbedPane = new LocationsTabbedPane(); locationsList = new LocationsList(this); if (slimUi) { getContentPane().add(locationsList); } else { final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, locationsList, locationsTabbedPane); splitPane.setOneTouchExpandable(true); getContentPane().add(splitPane); } // Create menus and toolbars final JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); final JToolBar toolBar = new JToolBar(); toolBar.setRollover(true); add(toolBar, BorderLayout.NORTH); createFileMenu(menuBar, toolBar); createActions(menuBar, toolBar); createOptionsMenu(menuBar, toolBar); createHelpMenu(menuBar, toolBar); // Open the first location Location firstTabLocation; final Collection<Location> recentLocations = UserPreferences.recentLocationsFile().getData(); if (recentLocations.size() > 0) { firstTabLocation = recentLocations.iterator().next(); } else { firstTabLocation = locationsList.getSelectedLocation(); } addLocationTab(firstTabLocation); } else { locationsTabbedPane = null; locationsList = null; final DaylightChartReport daylightChartReport = new DaylightChartReport(location, UserPreferences.optionsFile().getData()); final ChartPanel chartPanel = new ChartPanel(daylightChartReport.getChart()); chartPanel.setPreferredSize(ChartConfiguration.chartDimension); setContentPane(chartPanel); } pack(); }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
private JToolBar createChartToolbar() { JToolBar toolbar = new JToolBar(); ButtonGroup groupedButtons = new ButtonGroup(); // ACTION_CMD_PAN chartPanButton = new JToggleButton(); prepareButton(chartPanButton, ACTION_CHART_PAN, "de/unibayreuth/bayeos/goat/panels/Pan16.gif", "Pan mode"); groupedButtons.add(chartPanButton);/*from w w w .ja va 2 s . c o m*/ toolbar.add(chartPanButton); // ACTION_CMD_ZOOM_BOX chartZoomButton = new JToggleButton(); prepareButton(chartZoomButton, ACTION_CHART_ZOOM_BOX, "de/unibayreuth/bayeos/goat/panels/Zoom16.gif", "Zoom mode"); groupedButtons.add(chartZoomButton); chartZoomButton.setSelected(true); // no other makes sense after startup toolbar.add(chartZoomButton); // end of toggle-button group for select/pan/zoom-box toolbar.addSeparator(); // ACTION_CMD_ZOOM_IN chartZoomInButton = new JButton(); prepareButton(chartZoomInButton, ACTION_CHART_ZOOM_IN, "de/unibayreuth/bayeos/goat/panels/ZoomIn16.gif", "Zoom in"); toolbar.add(chartZoomInButton); // ACTION_CMD_ZOOM_OUT chartZoomOutButton = new JButton(); prepareButton(chartZoomOutButton, ACTION_CHART_ZOOM_OUT, "de/unibayreuth/bayeos/goat/panels/ZoomOut16.gif", "Zoom out"); toolbar.add(chartZoomOutButton); // ACTION_CMD_ZOOM_TO_FIT chartFitButton = new JButton(); prepareButton(chartFitButton, ACTION_CHART_ZOOM_TO_FIT, "de/unibayreuth/bayeos/goat/panels/ZoomExtent16.gif", "Zoom to extent"); toolbar.add(chartFitButton); toolbar.addSeparator(); chartExportButton = new JButton(); prepareButton(chartExportButton, ACTION_CHART_EXPORT, "de/unibayreuth/bayeos/goat/panels/Export16.gif", "Export chart image ..."); toolbar.add(chartExportButton); // ACTION_CMD_PRINT chartPrintButton = new JButton(); prepareButton(chartPrintButton, ACTION_CHART_PRINT, "de/unibayreuth/bayeos/goat/panels/Print16.gif", "Print chart ..."); toolbar.add(chartPrintButton); toolbar.addSeparator(); // ACTION_CMD_PROPERTIES chartPropertiesButton = new JButton(); prepareButton(chartPropertiesButton, ACTION_CHART_PROPERTIES, "de/unibayreuth/bayeos/goat/panels/Properties16.gif", "Chart properties ..."); toolbar.add(chartPropertiesButton); chartZoomOutButton.setEnabled(false); chartFitButton.setEnabled(false); return toolbar; }
From source file:com.igormaznitsa.ideamindmap.swing.PlainTextEditor.java
public PlainTextEditor(final Project project, final String text) { super(new BorderLayout()); this.editor = new EmptyTextEditor(project); final JToolBar menu = new JToolBar(); final JButton buttonImport = new JButton("Import", AllIcons.Buttons.IMPORT); final PlainTextEditor theInstance = this; buttonImport.addActionListener(new ActionListener() { @Override/*from ww w . j a va 2 s.co m*/ public void actionPerformed(ActionEvent e) { final File home = new File(System.getProperty("user.home")); //NOI18N final File toOpen = IdeaUtils.chooseFile(theInstance, true, BUNDLE.getString("PlainTextEditor.buttonLoadActionPerformed.title"), home, TEXT_FILE_FILTER); if (toOpen != null) { try { final String text = FileUtils.readFileToString(toOpen, "UTF-8"); //NOI18N editor.setText(text); } catch (Exception ex) { LOGGER.error("Error during text file loading", ex); //NOI18N Messages.showErrorDialog( BUNDLE.getString("PlainTextEditor.buttonLoadActionPerformed.msgError"), "Error"); } } } }); final JButton buttonExport = new JButton("Export", AllIcons.Buttons.EXPORT); buttonExport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final File home = new File(System.getProperty("user.home")); //NOI18N final File toSave = IdeaUtils.chooseFile(theInstance, true, BUNDLE.getString("PlainTextEditor.buttonSaveActionPerformed.saveTitle"), home, TEXT_FILE_FILTER); if (toSave != null) { try { final String text = getText(); FileUtils.writeStringToFile(toSave, text, "UTF-8"); //NOI18N } catch (Exception ex) { LOGGER.error("Error during text file saving", ex); //NOI18N Messages.showErrorDialog( BUNDLE.getString("PlainTextEditor.buttonSaveActionPerformed.msgError"), "Error"); } } } }); final JButton buttonCopy = new JButton("Copy", AllIcons.Buttons.COPY); buttonCopy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final StringSelection stringSelection = new StringSelection(editor.getSelectedText()); final Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpbrd.setContents(stringSelection, null); } }); final JButton buttonPaste = new JButton("Paste", AllIcons.Buttons.PASTE); buttonPaste.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { final String clipboardText = (String) Toolkit.getDefaultToolkit().getSystemClipboard() .getData(DataFlavor.stringFlavor); editor.replaceSelection(clipboardText); } catch (UnsupportedFlavorException ex) { // no text data in clipboard } catch (IOException ex) { LOGGER.error("Error during paste from clipboard", ex); //NOI18N } } }); final JButton buttonClearAll = new JButton("Clear All", AllIcons.Buttons.CLEARALL); buttonClearAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editor.clear(); } }); menu.add(buttonImport); menu.add(buttonExport); menu.add(buttonCopy); menu.add(buttonPaste); menu.add(buttonClearAll); this.add(menu, BorderLayout.NORTH); this.add(editor, BorderLayout.CENTER); // I made so strange trick to move the caret into the start of document, all other ways didn't work :( SwingUtilities.invokeLater(new Runnable() { @Override public void run() { editor.replaceSelection(text); } }); }
From source file:misc.ActionDemo.java
public void createToolBar() { JButton button = null;/* w w w .j a v a 2s .co m*/ //Create the toolbar. JToolBar toolBar = new JToolBar(); add(toolBar, BorderLayout.PAGE_START); //first button button = new JButton(leftAction); if (button.getIcon() != null) { button.setText(""); //an icon-only button } toolBar.add(button); //second button button = new JButton(middleAction); if (button.getIcon() != null) { button.setText(""); //an icon-only button } toolBar.add(button); //third button button = new JButton(rightAction); if (button.getIcon() != null) { button.setText(""); //an icon-only button } toolBar.add(button); }
From source file:edu.ucla.stat.SOCR.analyses.gui.ConfidenceIntervalAnalysis.java
/**Initialize the Analysis*/ public void init() { mapIndep = false;/*from ww w . j a va 2 s. c o m*/ INPUT = "CI SETTINGS"; showSelect = false; showVisualize = false; confidenceControlPanel = new ConfidenceControlPanel(this); confidenceControlPanel.setPreferredSize(new Dimension(200, 200)); confidenceControlPanel.addObserver(this); super.init(); analysisType = AnalysisType.CI; useInputExample = false; useLocalExample = false; useRandomExample = true; useServerExample = false; useStaticExample = CIExamples.availableExamples; onlineDescription = ""; depLabel.setText(VARIABLE); depMax = 100; // max number of dependent var indMax = 1; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); getFrame(this); analysisName = "Confidence Interval"; setName(analysisName); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); resetGraph(); validate(); //reset(); }
From source file:edu.ucla.stat.SOCR.analyses.gui.LogisticRegression.java
/**Initialize the Analysis*/ public void init() { showInput = false;//from w ww . j av a 2 s. co m showSelect = false; showVisualize = false; super.init(); analysisType = AnalysisType.LOGISTIC_REGRESSION; useInputExample = false; useLocalExample = false; useRandomExample = true; useServerExample = false; useStaticExample = LogisticRegressionExamples.availableExamples; onlineDescription = "http://en.wikipedia.org/wiki/Logistic_regression"; depMax = 1; // max number of dependent var indMax = 15; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("Regression & Correlation Analysis"); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); // use the new JFreeChar function. annie che 20060312 chartFactory = new Chart(); resetGraph(); validate(); }
From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaTwoWay.java
/**Initialize the Analysis*/ public void init() { showInput = false;//from w w w .j av a2s . c o m showSelect = false; showVisualize = false; super.init(); analysisType = AnalysisType.ANOVA_TWO_WAY; useInputExample = false; useLocalExample = false; useRandomExample = false; //useServerExample = false; useStaticExample = AnovaTwoWayExamples.availableExamples; onlineDescription = "http://wiki.stat.ucla.edu/socr/index.php/SOCR_EduMaterials_AnalysisActivities_ANOVA_2"; depMax = 1; // max number of dependent var indMax = 2; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("Two Way ANOVA"); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); // use the new JFreeChar function. annie che 20060312 chartFactory = new Chart(); resetGraph(); validate(); }
From source file:com.mindcognition.mindraider.ui.swing.trash.TrashJPanel.java
/** * Constructor.//from w ww. j a va2 s . c o m */ private TrashJPanel() { treeNodeToResourceUriMap = new HashMap(); rootNode = new DefaultMutableTreeNode(Messages.getString("TrashJPanel.notebookArchive")); treeModel = new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(new MyTreeModelListener()); tree = new JTree(treeModel); tree.setEditable(false); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.addTreeExpansionListener(this); tree.addTreeWillExpandListener(this); tree.setShowsRootHandles(true); tree.putClientProperty("JTree.lineStyle", "Angled"); // tree rendered // TODO implement own renderer in order to tooltips tree.setCellRenderer(new TrashTreeCellRenderer(IconsRegistry.getImageIcon("trashFull.png"), IconsRegistry.getImageIcon("explorerNotebookIcon.png"))); setLayout(new BorderLayout()); // control panel JToolBar tp = new JToolBar(); tp.setLayout(new GridLayout(1, 6)); undoButton = new JButton("", IconsRegistry.getImageIcon("trashUndo.png")); undoButton.setEnabled(false); undoButton.setToolTipText("Restore Outline"); undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) { return; } new RestoreNotebookJDialog((String) treeNodeToResourceUriMap.get(node), "Restore Outline", "Restore", true); } }); tp.add(undoButton); deleteButton = new JButton("", IconsRegistry.getImageIcon("explorerDeleteSmall.png")); deleteButton.setToolTipText("Delete Outline"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) { return; } int result = JOptionPane.showConfirmDialog(MindRaider.mainJFrame, "Do you really want to DELETE this Outline?", "Delete Outline", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { MindRaider.labelCustodian.deleteOutline((String) treeNodeToResourceUriMap.get(node)); refresh(); ExplorerJPanel.getInstance().refresh(); } } }); tp.add(deleteButton); emptyButton = new JButton("", IconsRegistry.getImageIcon("trashEmpty.png")); emptyButton.setToolTipText(Messages.getString("TrashJPanel.emptyArchive")); emptyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(MindRaider.mainJFrame, "Do you really want to DELETE all discarded Outlines?", "Empty Trash", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { final SwingWorker worker = new SwingWorker() { public Object construct() { ProgressDialogJFrame progressDialogJFrame = new ProgressDialogJFrame("Empty Trash", "<html><br> <b>Deleting:</b> </html>"); try { ResourceDescriptor[] resourceDescriptors = MindRaider.labelCustodian .getDiscardedOutlineDescriptors(); if (resourceDescriptors != null) { for (int i = 0; i < resourceDescriptors.length; i++) { MindRaider.labelCustodian.deleteOutline(resourceDescriptors[i].getUri()); } refresh(); } } finally { if (progressDialogJFrame != null) { progressDialogJFrame.dispose(); } } return null; } }; worker.start(); } } }); tp.add(emptyButton); add(tp, BorderLayout.NORTH); // add the tree JScrollPane scrollPane = new JScrollPane(tree); add(scrollPane); // build the whole tree buildTree(); // click handler tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) { return; } logger.debug("Tree selection path: " + node.getPath()[node.getLevel()]); enableDisableToolbarButtons(node.getLevel()); } }); }