List of usage examples for javax.swing JSeparator JSeparator
public JSeparator()
From source file:net.sf.mzmine.chartbasics.graphicsexport.GraphicsExportDialog.java
/** * Create the dialog./*from w ww . j a va 2s. co m*/ */ public GraphicsExportDialog() { final JFrame thisframe = this; // parameters = new GraphicsExportParameters(); chartParam = new ChartThemeParameters(); parametersAndComponents = new HashMap<String, JComponent>(); String[] formats = parameters.getParameter(GraphicsExportParameters.exportFormat).getChoices(); chooser.addChoosableFileFilter(new FileTypeFilter(formats, "Export images")); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // setBounds(100, 100, 808, 795); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new MigLayout("", "[][][grow]", "[][][][grow]")); { StringParameter p = parameters.getParameter(GraphicsExportParameters.path); StringComponent txtPath = p.createEditingComponent(); contentPanel.add(txtPath, "flowx,cell 0 0,growx"); parametersAndComponents.put(p.getName(), txtPath); } { btnPath = new JButton("Path"); btnPath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { choosePath(); } }); contentPanel.add(btnPath, "cell 1 0"); } { StringParameter p = parameters.getParameter(GraphicsExportParameters.filename); StringComponent txtFileName = p.createEditingComponent(); contentPanel.add(txtFileName, "cell 0 1,growx"); parametersAndComponents.put(p.getName(), txtFileName); } { JLabel lblFilename = new JLabel("filename"); contentPanel.add(lblFilename, "cell 1 1"); } { JPanel pnSettingsLeft = new JPanel(); pnSettingsLeft.setMinimumSize(new Dimension(260, 260)); contentPanel.add(pnSettingsLeft, "cell 0 3,grow"); pnSettingsLeft.setLayout(new BorderLayout(0, 0)); { GridBagPanel pn = new GridBagPanel(); { // add unit UserParameter p; JComponent comp; // add unit p = (UserParameter) parameters.getParameter(GraphicsExportParameters.unit); comp = p.createEditingComponent(); comp.setToolTipText(p.getDescription()); comp.setEnabled(true); pn.add(comp, 2, 2); parametersAndComponents.put(p.getName(), comp); int i = 0; // add export settings Parameter[] param = parameters.getParameters(); for (int pi = 3; pi < param.length; pi++) { p = (UserParameter) param[pi]; comp = p.createEditingComponent(); comp.setToolTipText(p.getDescription()); comp.setEnabled(true); pn.add(new JLabel(p.getName()), 0, i); pn.add(comp, 1, i, 1, 1, 1, 1); // add to map parametersAndComponents.put(p.getName(), comp); i++; } // add separator pn.add(new JSeparator(), 0, i, 5, 1, 1, 1, GridBagConstraints.BOTH); i++; // add Apply theme button JButton btnApply2 = new JButton("Apply theme"); btnApply2.addActionListener(e -> applyTheme()); pn.add(btnApply2, 0, i, 5, 1, 1, 1, GridBagConstraints.BOTH); i++; // add chart settings param = chartParam.getParameters(); for (int pi = 0; pi < param.length; pi++) { p = (UserParameter) param[pi]; comp = p.createEditingComponent(); comp.setToolTipText(p.getDescription()); comp.setEnabled(true); pn.add(new JLabel(p.getName()), 0, i); pn.add(comp, 1, i, 4, 1); // add to map parametersAndComponents.put(p.getName(), comp); i++; } // add listener to master font JFontSpecs master = (JFontSpecs) parametersAndComponents .get(chartParam.getParameter(ChartThemeParameters.masterFont).getName()); master.addListener(fspec -> { if (listenersEnabled) handleMasterFontChanged(fspec); }); } JScrollPane scrollPane = new JScrollPane(pn); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnSettingsLeft.add(scrollPane, BorderLayout.CENTER); scrollPane.getVerticalScrollBar().setUnitIncrement(18); scrollPane.revalidate(); scrollPane.repaint(); } } { { pnChartPreview = new JPanel(); pnChartPreview.setLayout(null); contentPanel.add(pnChartPreview, "cell 1 3 2 1,grow"); } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("Save"); okButton.addActionListener(e -> saveGraphicsAs()); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { btnRenewPreview = new JButton("Renew Preview"); btnRenewPreview.addActionListener(e -> renewPreview()); buttonPane.add(btnRenewPreview); } { btnApply = new JButton("Apply theme"); btnApply.addActionListener(e -> applyTheme()); buttonPane.add(btnApply); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(e -> setVisible(false)); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } // set all to components updateComponentsFromParameters(); }
From source file:edu.clemson.cs.nestbed.client.gui.NetworkMonitorFrame.java
private final JMenu buildNetworkMenu() { final JMenu menu = new JMenu("Network"); final JMenuItem install = new JMenuItem("Install Programs"); final JMenuItem vizMenu = new JMenuItem("Visualizations"); install.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new Thread() { public void run() { try { install.setEnabled(false); progDeployMgr.deployConfiguration(config.getID()); } catch (Exception ex) { log.error("Exception occured while installing " + "programs.", ex); ClientUtils.displayErrorMessage(NetworkMonitorFrame.this, ex); } finally { install.setEnabled(true); }/* ww w.j a va2 s.c o m*/ } }.start(); } }); menu.add(install); menu.add(new JSeparator()); vizMenu.addActionListener(new VisualizationMenuListener()); menu.add(vizMenu); return menu; }
From source file:net.sf.firemox.DeckBuilder.java
/** * Creates new form DeckBuilder//from w ww. ja v a 2 s . c o m */ private DeckBuilder() { super("DeckBuilder"); form = this; timerPanel = new TimerGlassPane(); cardLoader = new CardLoader(timerPanel); timer = new Timer(200, cardLoader); setGlassPane(timerPanel); try { setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif")); } catch (Exception e) { // IGNORING } // Load settings loadSettings(); // Initialize components final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this); newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK)); final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this); loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this); saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0)); final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this); quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK)); final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this); deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)); final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this); aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK)); final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this); final JMenu mainMenu = UIHelper.buildMenu("menu_file"); mainMenu.add(newItem); mainMenu.add(loadItem); mainMenu.add(saveAsItem); mainMenu.add(saveItem); mainMenu.add(new JSeparator()); mainMenu.add(quitItem); super.optionMenu = new JMenu("Options"); final JMenu convertMenu = UIHelper.buildMenu("menu_convert"); convertMenu.add(convertDCK); final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this); helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); final JMenu helpMenu = new JMenu("?"); helpMenu.add(helpItem); helpMenu.add(deckConstraintsItem); helpMenu.add(aboutItem); final JMenuBar menuBar = new JMenuBar(); menuBar.add(mainMenu); initAbstractMenu(); menuBar.add(optionMenu); menuBar.add(convertMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); addWindowListener(this); // Build the panel containing amount of available cards final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT); // Build the left list allListModel = new MListModel<MCardCompare>(amountLeft, false); leftList = new ThreadSafeJList(allListModel); leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); leftList.setLayoutOrientation(JList.VERTICAL); leftList.getSelectionModel().addListSelectionListener(this); leftList.addMouseListener(this); leftList.setVisibleRowCount(10); // Initialize the text field containing the amount to add addQtyTxt = new JTextField("1"); // Build the "Add" button addButton = new JButton(LanguageManager.getString("db_add")); addButton.setMnemonic('a'); addButton.setEnabled(false); // Build the panel containing : "Add" amount and "Add" button final Box addPanel = Box.createHorizontalBox(); addPanel.add(addButton); addPanel.add(addQtyTxt); addPanel.setMaximumSize(new Dimension(32010, 26)); // Build the panel containing the selected card name cardNameTxt = new JTextField(); new HireListener(cardNameTxt, addButton, this, leftList); final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : "); searchLabel.setLabelFor(cardNameTxt); // Build the panel containing search label and card name text field final Box searchPanel = Box.createHorizontalBox(); searchPanel.add(searchLabel); searchPanel.add(cardNameTxt); searchPanel.setMaximumSize(new Dimension(32010, 26)); listScrollerLeft = new JScrollPane(leftList); MToolKit.addOverlay(listScrollerLeft); // Build the left panel containing : list, available amount, "Add" panel final JPanel srcPanel = new JPanel(null); srcPanel.add(searchPanel); srcPanel.add(listScrollerLeft); srcPanel.add(amountLeft); srcPanel.add(addPanel); srcPanel.setMinimumSize(new Dimension(220, 200)); srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS)); // Initialize constraints constraintsChecker = new ConstraintsChecker(); constraintsChecker.setBorder(new EtchedBorder()); final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker); MToolKit.addOverlay(constraintsCheckerScroll); // create a pane with the oracle text for the present card oracleText = new JLabel(); oracleText.setPreferredSize(new Dimension(180, 200)); oracleText.setVerticalAlignment(SwingConstants.TOP); final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(oracle); // build some Pie Charts and a panel to display it initSets(); datasets = new ChartSets(); final JTabbedPane tabbedPane = new JTabbedPane(); for (ChartFilter filter : ChartFilter.values()) { final Dataset dataSet = filter.createDataSet(this); final JFreeChart chart = new JFreeChart(null, null, filter.createPlot(dataSet, painterMapper.get(filter)), false); datasets.addDataSet(filter, dataSet); ChartPanel pieChartPanel = new ChartPanel(chart, true); tabbedPane.add(pieChartPanel, filter.getTitle()); } // add the Constraints scroll panel and Oracle text Pane to the tabbedPane tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints")); tabbedPane.add(oracle, LanguageManager.getString("db_text")); tabbedPane.setSelectedComponent(oracle); // The toollBar for color filtering toolBar = new JToolBar(); toolBar.setFloatable(false); final JButton clearButton = UIHelper.buildButton("clear"); clearButton.addActionListener(this); toolBar.add(clearButton); final JToggleButton toggleColorlessButton = new JToggleButton( UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true); toggleColorlessButton.setActionCommand("0"); toggleColorlessButton.addActionListener(this); toolBar.add(toggleColorlessButton); for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) { final JToggleButton toggleButton = new JToggleButton( UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true); toggleButton.setActionCommand(String.valueOf(index)); toggleButton.addActionListener(this); toolBar.add(toggleButton); } // sorted card type combobox creation final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames)); Collections.sort(idCards); final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") }, idCards.toArray()); idCardComboBox = new JComboBox(cardTypes); idCardComboBox.setSelectedIndex(0); idCardComboBox.addActionListener(this); idCardComboBox.setActionCommand("cardTypeFilter"); // sorted card properties combobox creation final List<String> properties = new ArrayList<String>( CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty())); Collections.sort(properties); final Object[] cardProperties = ArrayUtils .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray()); propertiesComboBox = new JComboBox(cardProperties); propertiesComboBox.setSelectedIndex(0); propertiesComboBox.addActionListener(this); propertiesComboBox.setActionCommand("propertyFilter"); final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : "); final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : "); final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : "); // filter Panel with colors toolBar and card type combobox final Box filterPanel = Box.createHorizontalBox(); filterPanel.add(colors); filterPanel.add(toolBar); filterPanel.add(types); filterPanel.add(idCardComboBox); filterPanel.add(property); filterPanel.add(propertiesComboBox); getContentPane().add(filterPanel, BorderLayout.NORTH); // Destination section : // Build the panel containing amount of available cards final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT); rightAmount.setMaximumSize(new Dimension(220, 26)); // Build the right list rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true)); rightListModel.addTableModelListener(this); rightList = new JTable(rightListModel); rightList.setShowGrid(false); rightList.setTableHeader(null); rightList.getSelectionModel().addListSelectionListener(this); rightList.getColumnModel().getColumn(0).setMaxWidth(25); rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); // Build the panel containing the selected deck deckNameTxt = new JTextField("loading..."); deckNameTxt.setEditable(false); deckNameTxt.setBorder(null); final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : "); deckLabel.setLabelFor(deckNameTxt); final Box deckNamePanel = Box.createHorizontalBox(); deckNamePanel.add(deckLabel); deckNamePanel.add(deckNameTxt); deckNamePanel.setMaximumSize(new Dimension(220, 26)); // Initialize the text field containing the amount to remove removeQtyTxt = new JTextField("1"); // Build the "Remove" button removeButton = new JButton(LanguageManager.getString("db_remove")); removeButton.setMnemonic('r'); removeButton.addMouseListener(this); removeButton.setEnabled(false); // Build the panel containing : "Remove" amount and "Remove" button final Box removePanel = Box.createHorizontalBox(); removePanel.add(removeButton); removePanel.add(removeQtyTxt); removePanel.setMaximumSize(new Dimension(220, 26)); // Build the right panel containing : list, available amount, constraints final JScrollPane deskListScroller = new JScrollPane(rightList); MToolKit.addOverlay(deskListScroller); deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY)); deskListScroller.setMinimumSize(new Dimension(220, 200)); deskListScroller.setMaximumSize(new Dimension(220, 32000)); final Box destPanel = Box.createVerticalBox(); destPanel.add(deckNamePanel); destPanel.add(deskListScroller); destPanel.add(rightAmount); destPanel.add(removePanel); destPanel.setMinimumSize(new Dimension(220, 200)); destPanel.setMaximumSize(new Dimension(220, 32000)); // Build the panel containing the name of card in picture cardPictureNameTxt = new JLabel("<html><i>no selected card</i>"); final Box cardPictureNamePanel = Box.createHorizontalBox(); cardPictureNamePanel.add(cardPictureNameTxt); cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26)); // Group the detail panels final JPanel viewCard = new JPanel(null); viewCard.add(cardPictureNamePanel); viewCard.add(CardView.getInstance()); viewCard.add(tabbedPane); viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS)); final Box mainPanel = Box.createHorizontalBox(); mainPanel.add(destPanel); mainPanel.add(viewCard); // Add the main panel getContentPane().add(srcPanel, BorderLayout.WEST); getContentPane().add(mainPanel, BorderLayout.CENTER); // Size this frame getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT)); getRootPane().setMinimumSize(getRootPane().getPreferredSize()); pack(); }
From source file:com.hccl.nlip.GUIMainPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Super Fan bestActionChartPanel = new JPanel(); consolePanel = new JPanel(); RLCaptionPanel = new JPanel(); RLCaption = new JLabel(); discountLabel = new JLabel(); discountPanel = new JPanel(); discountDec = new JButton(); discountField = new JTextField(); discountInc = new JButton(); rewardCollisionLabel = new JLabel(); rewardCollisionPanel = new JPanel(); rewardCollisionDec = new JButton(); rewardCollisionField = new JTextField(); rewardCollisionInc = new JButton(); rewadGoalLabel = new JLabel(); rewardGoalPanel = new JPanel(); rewardGoalDec = new JButton(); rewardGoalField = new JTextField(); rewardGoalInc = new JButton(); rewardOneStepLabel = new JLabel(); rewardOneStepPanel = new JPanel(); rewardOneStepDec = new JButton(); rewardOneStepField = new JTextField(); rewardOneStepInc = new JButton(); fixedEpsilonCheckBox = new JCheckBox(); fixedEpsilonPanel = new JPanel(); fixedEpsilonField = new JTextField(); sepPanel1 = new JPanel(); separator1 = new JSeparator(); envCaptionPanel = new JPanel(); envLabel = new JLabel(); obstaclesLabel = new JLabel(); obstaclesPanel = new JPanel(); obstaclesComboBox = new JComboBox(); goalsLabel = new JLabel(); goalsPanel = new JPanel(); goalsComboBox = new JComboBox(); sepPanel2 = new JPanel(); separator2 = new JSeparator(); controlCaptionPanel = new JPanel(); controlLabel = new JLabel(); displayActionsPanel = new JPanel(); displayActionsCheckBox = new JCheckBox(); controlActionsPanel = new JPanel(); stepBtn = new JButton(); episodeBtn = new JButton(); animateBtn = new JButton(); resetBtn = new JButton(); controlEpisodesPanel = new JPanel(); performEpisodesBtn = new JButton(); numberEpisodesField = new JTextField(); numberEpisodesLabel = new JLabel(); episodesProgressBar = new JProgressBar(); sepPanel3 = new JPanel(); separator3 = new JSeparator(); totalStepsLabel = new JLabel(); totalStepsField = new JLabel(); totalEpisodesLabel = new JLabel(); totalEpisodesFields = new JLabel(); totalRewardLabel = new JLabel(); totalRewardField = new JLabel(); dicSizeField = new JLabel(); dicSizeLabel = new JLabel(); //======== this ======== setPreferredSize(new Dimension(700, 500)); setMinimumSize(new Dimension(780, 580)); setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 396, 239, 0 }; ((GridBagLayout) getLayout()).rowHeights = new int[] { 0, 0 }; ((GridBagLayout) getLayout()).columnWeights = new double[] { 1.0, 0.0, 1.0E-4 }; ((GridBagLayout) getLayout()).rowWeights = new double[] { 1.0, 1.0E-4 }; //======== bestActionChartPanel ======== {// ww w . j a va 2 s . co m bestActionChartPanel.setPreferredSize(new Dimension(250, 250)); bestActionChartPanel.setLayout(new BorderLayout()); } add(bestActionChartPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); //======== consolePanel ======== { consolePanel.setLayout(new GridBagLayout()); ((GridBagLayout) consolePanel.getLayout()).columnWidths = new int[] { 108, 129, 0 }; ((GridBagLayout) consolePanel.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) consolePanel.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) consolePanel.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; //======== RLCaptionPanel ======== { RLCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1)); //---- RLCaption ---- RLCaption.setText("RL Parameters"); RLCaption.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16)); RLCaptionPanel.add(RLCaption); } consolePanel.add(RLCaptionPanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- discountLabel ---- discountLabel.setText("Discount:"); consolePanel.add(discountLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== discountPanel ======== { discountPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2)); //---- discountDec ---- discountDec.setText("-"); discountDec.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { discountDecActionPerformed(e); } }); discountPanel.add(discountDec); //---- discountField ---- discountField.setText("000.00"); discountField.setColumns(6); discountPanel.add(discountField); //---- discountInc ---- discountInc.setText("+"); discountInc.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { discountIncActionPerformed(e); } }); discountPanel.add(discountInc); } consolePanel.add(discountPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- rewardCollisionLabel ---- rewardCollisionLabel.setText("Reward collision:"); consolePanel.add(rewardCollisionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== rewardCollisionPanel ======== { rewardCollisionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2)); //---- rewardCollisionDec ---- rewardCollisionDec.setText("-"); rewardCollisionDec.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardCollisionDecActionPerformed(e); } }); rewardCollisionPanel.add(rewardCollisionDec); //---- rewardCollisionField ---- rewardCollisionField.setText("000.00"); rewardCollisionField.setColumns(6); rewardCollisionPanel.add(rewardCollisionField); //---- rewardCollisionInc ---- rewardCollisionInc.setText("+"); rewardCollisionInc.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardCollisionIncActionPerformed(e); } }); rewardCollisionPanel.add(rewardCollisionInc); } consolePanel.add(rewardCollisionPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- rewadGoalLabel ---- rewadGoalLabel.setText("Reward goal:"); consolePanel.add(rewadGoalLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== rewardGoalPanel ======== { rewardGoalPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2)); //---- rewardGoalDec ---- rewardGoalDec.setText("-"); rewardGoalDec.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardGoalDecActionPerformed(e); } }); rewardGoalPanel.add(rewardGoalDec); //---- rewardGoalField ---- rewardGoalField.setText("000.00"); rewardGoalField.setColumns(6); rewardGoalPanel.add(rewardGoalField); //---- rewardGoalInc ---- rewardGoalInc.setText("+"); rewardGoalInc.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardGoalIncActionPerformed(e); } }); rewardGoalPanel.add(rewardGoalInc); } consolePanel.add(rewardGoalPanel, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- rewardOneStepLabel ---- rewardOneStepLabel.setText("Reward one step:"); consolePanel.add(rewardOneStepLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== rewardOneStepPanel ======== { rewardOneStepPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2)); //---- rewardOneStepDec ---- rewardOneStepDec.setText("-"); rewardOneStepDec.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardOneStepDecActionPerformed(e); } }); rewardOneStepPanel.add(rewardOneStepDec); //---- rewardOneStepField ---- rewardOneStepField.setText("000.00"); rewardOneStepField.setColumns(6); rewardOneStepPanel.add(rewardOneStepField); //---- rewardOneStepInc ---- rewardOneStepInc.setText("+"); rewardOneStepInc.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rewardOneStepIncActionPerformed(e); } }); rewardOneStepPanel.add(rewardOneStepInc); } consolePanel.add(rewardOneStepPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- fixedEpsilonCheckBox ---- fixedEpsilonCheckBox.setText("Fixed Epsilon:"); fixedEpsilonCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fixedEpsilonCheckBoxActionPerformed(e); } }); consolePanel.add(fixedEpsilonCheckBox, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== fixedEpsilonPanel ======== { fixedEpsilonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2)); //---- fixedEpsilonField ---- fixedEpsilonField.setText("00.10"); fixedEpsilonField.setColumns(6); fixedEpsilonPanel.add(fixedEpsilonField); } consolePanel.add(fixedEpsilonPanel, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0)); //======== sepPanel1 ======== { sepPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); //---- separator1 ---- separator1.setPreferredSize(new Dimension(210, 2)); sepPanel1.add(separator1); } consolePanel.add(sepPanel1, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== envCaptionPanel ======== { envCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1)); //---- envLabel ---- envLabel.setText("Environment"); envLabel.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16)); envCaptionPanel.add(envLabel); } consolePanel.add(envCaptionPanel, new GridBagConstraints(0, 7, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- obstaclesLabel ---- obstaclesLabel.setText("Obstacles:"); consolePanel.add(obstaclesLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== obstaclesPanel ======== { obstaclesPanel.setLayout(new FlowLayout()); //---- obstaclesComboBox ---- obstaclesComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { obstaclesComboBoxActionPerformed(e); } }); obstaclesPanel.add(obstaclesComboBox); } consolePanel.add(obstaclesPanel, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0)); //---- goalsLabel ---- goalsLabel.setText("Goals:"); consolePanel.add(goalsLabel, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //======== goalsPanel ======== { goalsPanel.setLayout(new FlowLayout()); //---- goalsComboBox ---- goalsComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { goalsComboBoxActionPerformed(e); } }); goalsPanel.add(goalsComboBox); } consolePanel.add(goalsPanel, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0)); //======== sepPanel2 ======== { sepPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); //---- separator2 ---- separator2.setPreferredSize(new Dimension(210, 2)); sepPanel2.add(separator2); } consolePanel.add(sepPanel2, new GridBagConstraints(0, 10, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== controlCaptionPanel ======== { controlCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1)); //---- controlLabel ---- controlLabel.setText("Control"); controlLabel.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16)); controlCaptionPanel.add(controlLabel); } consolePanel.add(controlCaptionPanel, new GridBagConstraints(0, 11, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== displayActionsPanel ======== { displayActionsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); //---- displayActionsCheckBox ---- displayActionsCheckBox.setText("Display action vectors"); displayActionsCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayActionsCheckBoxActionPerformed(e); } }); displayActionsPanel.add(displayActionsCheckBox); } consolePanel.add(displayActionsPanel, new GridBagConstraints(0, 12, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== controlActionsPanel ======== { controlActionsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0)); //---- stepBtn ---- stepBtn.setText("1 Step"); stepBtn.setMargin(new Insets(2, 2, 2, 2)); stepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { stepBtnActionPerformed(e); } }); controlActionsPanel.add(stepBtn); //---- episodeBtn ---- episodeBtn.setText("1 Episode"); episodeBtn.setMargin(new Insets(2, 4, 2, 4)); episodeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { episodeBtnActionPerformed(e); } }); controlActionsPanel.add(episodeBtn); //---- animateBtn ---- animateBtn.setText("Animate"); animateBtn.setMargin(new Insets(2, 2, 2, 2)); animateBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { animateBtnActionPerformed(e); } }); controlActionsPanel.add(animateBtn); //---- resetBtn ---- resetBtn.setText("Reset"); resetBtn.setMargin(new Insets(2, 2, 2, 2)); resetBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { resetBtnActionPerformed(e); } }); controlActionsPanel.add(resetBtn); } consolePanel.add(controlActionsPanel, new GridBagConstraints(0, 13, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== controlEpisodesPanel ======== { controlEpisodesPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0)); //---- performEpisodesBtn ---- performEpisodesBtn.setText("Perform"); performEpisodesBtn.setMargin(new Insets(2, 2, 2, 2)); performEpisodesBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { performEpisodesBtnActionPerformed(e); } }); controlEpisodesPanel.add(performEpisodesBtn); //---- numberEpisodesField ---- numberEpisodesField.setText("100"); numberEpisodesField.setColumns(5); controlEpisodesPanel.add(numberEpisodesField); //---- numberEpisodesLabel ---- numberEpisodesLabel.setText("episodes"); controlEpisodesPanel.add(numberEpisodesLabel); //---- episodesProgressBar ---- episodesProgressBar.setMinimumSize(new Dimension(5, 10)); episodesProgressBar.setPreferredSize(new Dimension(80, 20)); controlEpisodesPanel.add(episodesProgressBar); } consolePanel.add(controlEpisodesPanel, new GridBagConstraints(0, 14, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //======== sepPanel3 ======== { sepPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); //---- separator3 ---- separator3.setPreferredSize(new Dimension(210, 2)); sepPanel3.add(separator3); } consolePanel.add(sepPanel3, new GridBagConstraints(0, 15, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- totalStepsLabel ---- totalStepsLabel.setText("Total steps:"); consolePanel.add(totalStepsLabel, new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //---- totalStepsField ---- totalStepsField.setText("0000000"); consolePanel.add(totalStepsField, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- totalEpisodesLabel ---- totalEpisodesLabel.setText("Total episodes:"); consolePanel.add(totalEpisodesLabel, new GridBagConstraints(0, 17, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //---- totalEpisodesFields ---- totalEpisodesFields.setText("0000000"); consolePanel.add(totalEpisodesFields, new GridBagConstraints(1, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- totalRewardLabel ---- totalRewardLabel.setText("Total reward:"); consolePanel.add(totalRewardLabel, new GridBagConstraints(0, 18, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); //---- totalRewardField ---- totalRewardField.setText("00000000.00000000"); consolePanel.add(totalRewardField, new GridBagConstraints(1, 18, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- dicSizeField ---- dicSizeField.setText("00000000.00000000"); consolePanel.add(dicSizeField, new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- dicSizeLabel ---- dicSizeLabel.setText("Dictionary size:"); consolePanel.add(dicSizeLabel, new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0)); } add(consolePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); // JFormDesigner - End of component initialization //GEN-END:initComponents mazeEnv = new MazeEnvironment(); controller = (GPSARSASparseController) mazeEnv.controller(); JFreeChart jFreeChart = mazeEnv.genGraph(); //Put the jFreeChart in a chartPanel ChartPanel chartPanel = new ChartPanel(jFreeChart); chartPanel.setPreferredSize(new Dimension(250, 250)); syncParamsToGUI(); syncStatusToGUI(); bestActionChartPanel.add(chartPanel, BorderLayout.CENTER); }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JMenu buildConfigurationMenu() { final JMenu menu = new JMenu("Configuration"); final JMenuItem addConfig = new JMenuItem("Add"); final JMenuItem cloneConfig = new JMenuItem("Clone"); final JMenuItem modifyConfig = new JMenuItem("Modify"); final JMenuItem deleteConfig = new JMenuItem("Delete"); final JMenuItem viewNetMonitor = new JMenuItem("View Network Monitor"); addConfig.addActionListener(new AddConfigurationActionListener()); menu.add(addConfig);/* w w w . j ava 2 s . c o m*/ cloneConfig.addActionListener(new CloneConfigurationActionListener()); menu.add(cloneConfig); modifyConfig.addActionListener(new ViewConfigurationActionListener()); menu.add(modifyConfig); deleteConfig.addActionListener(new DeleteConfigurationActionListener()); menu.add(deleteConfig); menu.add(new JSeparator()); viewNetMonitor.addActionListener(new ViewNetworkMonitorActionListener()); menu.add(viewNetMonitor); menu.addMenuListener( new ConfigurationMenuListener(addConfig, cloneConfig, deleteConfig, modifyConfig, viewNetMonitor)); return menu; }
From source file:net.nikr.eve.jeveasset.gui.tabs.tracker.TrackerTab.java
public TrackerTab(Program program) { super(program, TabsTracker.get().title(), Images.TOOL_TRACKER.getIcon(), true); filterDialog = new TrackerFilterDialog(program); jPopupMenu = new JPopupMenu(); jPopupMenu.addPopupMenuListener(listener); JMenuItem jMenuItem;//from w ww . jav a 2s . c om jMenuItem = new JMenuItem(TabsTracker.get().edit(), Images.EDIT_EDIT.getIcon()); jMenuItem.setActionCommand(TrackerAction.EDIT.name()); jMenuItem.addActionListener(listener); jPopupMenu.add(jMenuItem); jMenuItem = new JMenuItem(TabsTracker.get().delete(), Images.EDIT_DELETE.getIcon()); jMenuItem.setActionCommand(TrackerAction.DELETE.name()); jMenuItem.addActionListener(listener); jPopupMenu.add(jMenuItem); JMenuInfo.createDefault(jPopupMenu); jIskValue = new JMenuItem(); jIskValue.setEnabled(false); jIskValue.setForeground(Color.BLACK); jIskValue.setHorizontalAlignment(SwingConstants.RIGHT); jIskValue.setDisabledIcon(Images.TOOL_VALUES.getIcon()); jPopupMenu.add(jIskValue); jDateValue = new JMenuItem(); jDateValue.setEnabled(false); jDateValue.setForeground(Color.BLACK); jDateValue.setHorizontalAlignment(SwingConstants.RIGHT); jPopupMenu.add(jDateValue); jEditDialog = new JTrackerEditDialog(program); jSelectionDialog = new JSelectionDialog(program); JSeparator jDateSeparator = new JSeparator(); jQuickDate = new JComboBox<QuickDate>(QuickDate.values()); jQuickDate.setActionCommand(TrackerAction.QUICK_DATE.name()); jQuickDate.addActionListener(listener); JLabel jFromLabel = new JLabel(TabsTracker.get().from()); jFrom = createDateChooser(); JLabel jToLabel = new JLabel(TabsTracker.get().to()); jTo = createDateChooser(); jAll = new JCheckBox(General.get().all()); jAll.setSelected(true); jAll.setActionCommand(TrackerAction.ALL.name()); jAll.addActionListener(listener); jAll.setFont(new Font(jAll.getFont().getName(), Font.ITALIC, jAll.getFont().getSize())); jTotal = new JCheckBox(TabsTracker.get().total()); jTotal.setSelected(true); jTotal.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jTotal.addActionListener(listener); jWalletBalance = new JCheckBox(TabsTracker.get().walletBalance()); jWalletBalance.setSelected(true); jWalletBalance.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jWalletBalance.addActionListener(listener); jWalletBalanceFilters = new JButton(Images.LOC_INCLUDE.getIcon()); jWalletBalanceFilters.setActionCommand(TrackerAction.FILTER_WALLET_BALANCE.name()); jWalletBalanceFilters.addActionListener(listener); jAssets = new JCheckBox(TabsTracker.get().assets()); jAssets.setSelected(true); jAssets.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jAssets.addActionListener(listener); jAssetsFilters = new JButton(Images.LOC_INCLUDE.getIcon()); jAssetsFilters.setActionCommand(TrackerAction.FILTER_ASSETS.name()); jAssetsFilters.addActionListener(listener); jSellOrders = new JCheckBox(TabsTracker.get().sellOrders()); jSellOrders.setSelected(true); jSellOrders.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jSellOrders.addActionListener(listener); jEscrows = new JCheckBox(TabsTracker.get().escrows()); jEscrows.setSelected(true); jEscrows.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jEscrows.addActionListener(listener); jEscrowsToCover = new JCheckBox(TabsTracker.get().escrowsToCover()); jEscrowsToCover.setSelected(true); jEscrowsToCover.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jEscrowsToCover.addActionListener(listener); jManufacturing = new JCheckBox(TabsTracker.get().manufacturing()); jManufacturing.setSelected(true); jManufacturing.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jManufacturing.addActionListener(listener); jContractCollateral = new JCheckBox(TabsTracker.get().contractCollateral()); jContractCollateral.setSelected(true); jContractCollateral.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jContractCollateral.addActionListener(listener); jContractValue = new JCheckBox(TabsTracker.get().contractValue()); jContractValue.setSelected(true); jContractValue.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jContractValue.addActionListener(listener); JSeparator jOwnersSeparator = new JSeparator(); jAllProfiles = new JCheckBox(TabsTracker.get().allProfiles()); jAllProfiles.setActionCommand(TrackerAction.PROFILE.name()); jAllProfiles.addActionListener(listener); jOwners = new JMultiSelectionList<String>(); jOwners.getSelectionModel().addListSelectionListener(listener); JScrollPane jOwnersScroll = new JScrollPane(jOwners); JLabel jHelp = new JLabel(TabsTracker.get().help()); jHelp.setIcon(Images.MISC_HELP.getIcon()); JLabel jNoFilter = new JLabel(TabsTracker.get().helpLegacyData()); jNoFilter.setIcon(new ShapeIcon(NO_FILTER)); JLabel jFilter = new JLabel(TabsTracker.get().helpNewData()); jFilter.setIcon(new ShapeIcon(FILTER_AND_DEFAULT)); JDropDownButton jSettings = new JDropDownButton(Images.DIALOG_SETTINGS.getIcon()); jIncludeZero = new JCheckBoxMenuItem(TabsTracker.get().includeZero()); jIncludeZero.setSelected(true); jIncludeZero.setActionCommand(TrackerAction.INCLUDE_ZERO.name()); jIncludeZero.addActionListener(listener); jSettings.add(jIncludeZero); DateAxis domainAxis = new DateAxis(); domainAxis.setDateFormatOverride(dateFormat); domainAxis.setVerticalTickLabels(true); domainAxis.setAutoTickUnitSelection(true); domainAxis.setAutoRange(true); domainAxis.setTickLabelFont(jFromLabel.getFont()); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRange(true); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(jFromLabel.getFont()); //XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, new XYLineAndShapeRenderer(true, true)); render = new MyRender(); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, render); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.getRenderer() .setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: {2} ({1})", dateFormat, iskFormat)); plot.setDomainCrosshairLockedOnData(true); plot.setDomainCrosshairStroke(new BasicStroke(1)); plot.setDomainCrosshairPaint(Color.BLACK); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); jNextChart = new JFreeChart(plot); jNextChart.setAntiAlias(true); jNextChart.setBackgroundPaint(jPanel.getBackground()); jNextChart.addProgressListener(null); jNextChart.getLegend().setItemFont(jFrom.getFont()); jChartPanel = new ChartPanel(jNextChart); jChartPanel.addMouseListener(listener); jChartPanel.setDomainZoomable(false); jChartPanel.setRangeZoomable(false); jChartPanel.setPopupMenu(null); jChartPanel.addChartMouseListener(listener); jChartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); jChartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); jChartPanel.setMinimumDrawWidth(10); jChartPanel.setMinimumDrawHeight(10); int AssetsGapWidth = PANEL_WIDTH - jAssets.getPreferredSize().width - jAssetsFilters.getPreferredSize().width; if (AssetsGapWidth < 0) { AssetsGapWidth = 0; } int WalletGapWidth = PANEL_WIDTH - jWalletBalance.getPreferredSize().width - jWalletBalanceFilters.getPreferredSize().width; if (WalletGapWidth < 0) { WalletGapWidth = 0; } layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup().addComponent(jHelp).addGap(20).addComponent(jNoFilter) .addGap(20).addComponent(jFilter).addGap(20, 20, Integer.MAX_VALUE).addComponent(jSettings) .addGap(6)) .addComponent(jChartPanel)).addGroup( layout.createParallelGroup().addComponent(jQuickDate, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(jFromLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH) .addComponent(jToLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH)) .addGap(0) .addGroup(layout.createParallelGroup() .addComponent(jFrom, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH) .addComponent(jTo, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH))) .addComponent(jDateSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jAll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jTotal, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addGroup(layout.createSequentialGroup().addComponent(jWalletBalance) .addGap(0, 0, WalletGapWidth).addComponent(jWalletBalanceFilters)) .addGroup(layout.createSequentialGroup().addComponent(jAssets) .addGap(0, 0, AssetsGapWidth).addComponent(jAssetsFilters)) .addComponent(jSellOrders, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jEscrows, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jEscrowsToCover, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jManufacturing, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jContractCollateral, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jContractValue, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jOwnersSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jAllProfiles, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jOwnersScroll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH))); layout.setVerticalGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup() .addComponent(jHelp, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jNoFilter, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jFilter, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jSettings, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jChartPanel)) .addGroup(layout.createSequentialGroup() .addComponent(jQuickDate, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addGroup(layout.createParallelGroup() .addComponent(jFromLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jFrom, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addGroup(layout.createParallelGroup() .addComponent(jToLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jTo, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jDateSeparator, 3, 3, 3) .addComponent(jAll, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jTotal, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addGroup(layout.createParallelGroup() .addComponent(jWalletBalance, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jWalletBalanceFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addGroup(layout.createParallelGroup() .addComponent(jAssets, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jAssetsFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jSellOrders, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jEscrows, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jEscrowsToCover, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jManufacturing, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jContractCollateral, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jContractValue, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jOwnersSeparator, 3, 3, 3) .addComponent(jAllProfiles, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jOwnersScroll, 70, 70, Integer.MAX_VALUE))); }
From source file:com.univocity.app.swing.DataAnalysisWindow.java
private void addPopupMenuToTable(DaoTable daoTable, boolean isSourceTable) { String engineName = isSourceTable ? config.getSourceEngineName() : config.getDestinationEngineName(); if (engineName == null) { return;//from ww w .ja v a2 s .c o m } final JTable table = daoTable.getDataTable(); final JPopupMenu menu = new JPopupMenu(); menu.add(newJMenuItem("Disable updates", daoTable, engineName, false, false)); menu.add(newJMenuItem("Enable updates", daoTable, engineName, true, false)); menu.add(new JSeparator()); menu.add(newJMenuItem("Disable updates on all rows", daoTable, engineName, false, true)); menu.add(newJMenuItem("Enable updates on all rows", daoTable, engineName, true, true)); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { int rowNumber = table.rowAtPoint(e.getPoint()); if (rowNumber != -1) { table.getSelectionModel().setSelectionInterval(rowNumber, rowNumber); menu.show(table, e.getX(), e.getY()); } } }; }); }
From source file:com.rapidminer.gui.new_plotter.gui.dialog.AddParallelLineDialog.java
/** * Setup the GUI.//from w ww .j a va 2 s . c om */ private void setupGUI() { JPanel mainPanel = new JPanel(); this.setContentPane(mainPanel); // start layout mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); horizontalLineRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.label")); horizontalLineRadiobutton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.tip")); horizontalLineRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setHorizontalLineSelected(); } }); horizontalLineRadiobutton.setSelected(true); this.add(horizontalLineRadiobutton, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.EAST; verticalLineRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.label")); verticalLineRadiobutton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.tip")); verticalLineRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVerticalLineSelected(); } }); this.add(verticalLineRadiobutton, gbc); ButtonGroup group = new ButtonGroup(); group.add(horizontalLineRadiobutton); group.add(verticalLineRadiobutton); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.CENTER; rangeAxisSelectionCombobox = new JComboBox(); rangeAxisSelectionCombobox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.range_axis_combobox.tip")); rangeAxisSelectionCombobox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateYFieldValue(); } }); this.add(rangeAxisSelectionCombobox, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); JLabel xLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.label")); this.add(xLabel, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(2, 5, 2, 5); gbc.fill = GridBagConstraints.HORIZONTAL; xField = new JTextField(); xField.setText(String.valueOf(x)); xField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyYInput(input); } }); xField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.tip")); xField.setEnabled(false); this.add(xField, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.NONE; JLabel yLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.label")); this.add(yLabel, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; yField = new JTextField(); yField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.tip")); yField.setText(String.valueOf(y)); yField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyXInput(input); } }); this.add(yField, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(10, 5, 0, 5); modifyLineButton = new JButton(); modifyLineButton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.tip")); modifyLineButton.setIcon(SwingTools.createIcon( "16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.icon"))); modifyLineButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { modifyLine(); } }); this.add(modifyLineButton, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(15, 5, 5, 5); this.add(new JSeparator(), gbc); gbc.gridx = 0; gbc.gridy = 6; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.label")); okButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.tip")); okButton.setIcon(SwingTools .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.icon"))); okButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.mne").toCharArray()[0]); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean successful = addSpecifiedLine(); // don't dispose dialog if not successful if (!successful) { return; } AddParallelLineDialog.this.dispose(); } }); okButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { okButton.doClick(); } } }); this.add(okButton, gbc); gbc.gridx = 1; gbc.gridy = 6; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; cancelButton = new JButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.label")); cancelButton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.tip")); cancelButton.setIcon(SwingTools.createIcon( "24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.icon"))); cancelButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.mne").toCharArray()[0]); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // cancel requested, close dialog AddParallelLineDialog.this.dispose(); } }); this.add(cancelButton, gbc); // misc settings this.setMinimumSize(new Dimension(300, 250)); // center dialog this.setLocationRelativeTo(null); this.setTitle(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.title.label")); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setModal(true); this.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { okButton.requestFocusInWindow(); } }); }
From source file:fedroot.dacs.swingdemo.DacsSingleFrameApplication.java
private JComponent createActionsPanel() { JButton clientCredentialsButton = new JButton(actionMap().get("clientCredentials")); JButton componentButton = new JButton(actionMap().get("blockComponent")); JButton applicationButton = new JButton(actionMap().get("blockApplication")); JButton windowButton = new JButton(actionMap().get("blockWindow")); JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 50)); panel1.add(clientCredentialsButton); panel1.add(componentButton);//from ww w . ja v a 2 s. com panel1.add(applicationButton); panel1.add(windowButton); JPanel panel2 = new JPanel(new BorderLayout()); panel2.add(createGotoPanel(), BorderLayout.NORTH); panel2.add(new JSeparator(), BorderLayout.CENTER); panel2.add(panel1, BorderLayout.SOUTH); panel2.setBorder(new EmptyBorder(0, 2, 0, 2)); // top, left, bottom, right return panel2; }
From source file:io.github.dsheirer.gui.SDRTrunk.java
/** * Initialize the contents of the frame. *///from ww w . j av a 2 s .c o m private void initGUI() { mMainGui.setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]")); /** * Setup main JFrame window */ mTitle = SystemProperties.getInstance().getApplicationName(); mMainGui.setTitle(mTitle); mMainGui.setBounds(100, 100, 1280, 800); mMainGui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Set preferred sizes to influence the split mSpectralPanel.setPreferredSize(new Dimension(1280, 300)); mControllerPanel.setPreferredSize(new Dimension(1280, 500)); mSplitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT); mSplitPane.setDividerSize(5); mSplitPane.add(mSpectralPanel); mSplitPane.add(mControllerPanel); mBroadcastStatusVisible = SystemProperties.getInstance().get(PROPERTY_BROADCAST_STATUS_VISIBLE, false); //Show broadcast status panel when user requests - disabled by default if (mBroadcastStatusVisible) { mSplitPane.add(getBroadcastStatusPanel()); } mMainGui.add(mSplitPane, "cell 0 0,span,grow"); /** * Menu items */ JMenuBar menuBar = new JMenuBar(); mMainGui.setJMenuBar(menuBar); JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); JMenuItem logFilesMenu = new JMenuItem("Logs & Recordings"); logFilesMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().open(getHomePath().toFile()); } catch (Exception e) { mLog.error("Couldn't open file explorer"); JOptionPane.showMessageDialog(mMainGui, "Can't launch file explorer - files are located at: " + getHomePath().toString(), "Can't launch file explorer", JOptionPane.ERROR_MESSAGE); } } }); fileMenu.add(logFilesMenu); JMenuItem settingsMenu = new JMenuItem("Icon Manager"); settingsMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { mIconManager.showEditor(mMainGui); } }); fileMenu.add(settingsMenu); fileMenu.add(new JSeparator()); JMenuItem exitMenu = new JMenuItem("Exit"); exitMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); fileMenu.add(exitMenu); JMenu viewMenu = new JMenu("View"); viewMenu.add(new BroadcastStatusVisibleMenuItem(mControllerPanel)); menuBar.add(viewMenu); JMenuItem screenCaptureItem = new JMenuItem("Screen Capture"); screenCaptureItem.setMnemonic(KeyEvent.VK_C); screenCaptureItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)); screenCaptureItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { Robot robot = new Robot(); final BufferedImage image = robot.createScreenCapture(mMainGui.getBounds()); SystemProperties props = SystemProperties.getInstance(); Path capturePath = props.getApplicationFolder("screen_captures"); if (!Files.exists(capturePath)) { try { Files.createDirectory(capturePath); } catch (IOException e) { mLog.error("Couldn't create 'screen_captures' " + "subdirectory in the " + "SDRTrunk application directory", e); } } String filename = TimeStamp.getTimeStamp("_") + "_screen_capture.png"; final Path captureFile = capturePath.resolve(filename); EventQueue.invokeLater(new Runnable() { @Override public void run() { try { ImageIO.write(image, "png", captureFile.toFile()); } catch (IOException e) { mLog.error("Couldn't write screen capture to " + "file [" + captureFile.toString() + "]", e); } } }); } catch (AWTException e) { mLog.error("Exception while taking screen capture", e); } } }); menuBar.add(screenCaptureItem); }