List of usage examples for java.awt FlowLayout CENTER
int CENTER
To view the source code for java.awt FlowLayout CENTER.
Click Source Link
From source file:net.pms.newgui.StatusTab.java
public JComponent build() { // Apply the orientation for the locale ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale()); String colSpec = FormLayoutUtil.getColSpec("pref, 30dlu, fill:pref:grow, 30dlu, pref", orientation); // 1 2 3 4 5 FormLayout layout = new FormLayout(colSpec, // 1 2 3 4 5 // ////////////////////////////////////////////////// "p," // Detected Media Renderers --------------------// 1 + "9dlu," // // + "fill:p:grow," // <renderers> // 3 + "3dlu," // // + "p," // ---------------------------------------------// 5 + "3dlu," // | | // + "p," // Connected | Memory Usage |<bitrate> // 7 + "3dlu," // | | // + "p," // <icon> | <statusbar> | // 9 ////////////////////////////////////////////////// );/*from w w w . j a v a 2 s . com*/ PanelBuilder builder = new PanelBuilder(layout); builder.border(Borders.DIALOG); builder.opaque(true); CellConstraints cc = new CellConstraints(); // Renderers JComponent cmp = builder.addSeparator(Messages.getString("StatusTab.9"), FormLayoutUtil.flip(cc.xyw(1, 1, 5), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); Font bold = cmp.getFont().deriveFont(Font.BOLD); Color fgColor = new Color(68, 68, 68); cmp.setFont(bold); renderers = new JPanel(new GuiUtil.WrapLayout(FlowLayout.CENTER, 20, 10)); JScrollPane rsp = new JScrollPane(renderers, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); rsp.setBorder(BorderFactory.createEmptyBorder()); rsp.setPreferredSize(new Dimension(0, 260)); rsp.getHorizontalScrollBar().setLocation(0, 250); builder.add(rsp, cc.xyw(1, 3, 5)); cmp = builder.addSeparator(null, FormLayoutUtil.flip(cc.xyw(1, 5, 5), colSpec, orientation)); // Connected jl = new JLabel(Messages.getString("StatusTab.3")); builder.add(jl, FormLayoutUtil.flip(cc.xy(1, 7, "center, top"), colSpec, orientation)); jl.setFont(bold); jl.setForeground(fgColor); imagePanel = buildImagePanel("/resources/images/icon-status-connecting.png"); builder.add(imagePanel, FormLayoutUtil.flip(cc.xy(1, 9), colSpec, orientation)); // Memory memBarUI = new GuiUtil.SegmentedProgressBarUI(Color.white, Color.gray); memBarUI.setActiveLabel("{}", Color.white, 0); memBarUI.setActiveLabel("{}", Color.red, 90); memBarUI.addSegment("", memColor); memBarUI.addSegment("", bufColor); memBarUI.setTickMarks(getTickMarks(), "{}"); memoryProgressBar = new GuiUtil.CustomUIProgressBar(0, 100, memBarUI); memoryProgressBar.setStringPainted(true); memoryProgressBar.setForeground(new Color(75, 140, 181)); memoryProgressBar.setString(Messages.getString("StatusTab.5")); JLabel mem = builder .addLabel( "<html><b>" + Messages.getString("StatusTab.6") + "</b> (" + Messages.getString("StatusTab.12") + ")</html>", FormLayoutUtil.flip(cc.xy(3, 7), colSpec, orientation)); mem.setForeground(fgColor); builder.add(memoryProgressBar, FormLayoutUtil.flip(cc.xyw(3, 9, 1), colSpec, orientation)); // Bitrate String bitColSpec = "left:pref, 3dlu, right:pref:grow"; PanelBuilder bitrateBuilder = new PanelBuilder(new FormLayout(bitColSpec, "p, 1dlu, p, 1dlu, p")); bitrateLabel = new JLabel("<html><b>" + Messages.getString("StatusTab.13") + "</b> (" + Messages.getString("StatusTab.11") + ")</html>"); bitrateLabel.setForeground(fgColor); bitrateBuilder.add(bitrateLabel, FormLayoutUtil.flip(cc.xy(1, 1), bitColSpec, orientation)); currentBitrateLabel = new JLabel(Messages.getString("StatusTab.14")); currentBitrateLabel.setForeground(fgColor); bitrateBuilder.add(currentBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 3), bitColSpec, orientation)); currentBitrate = new JLabel("0"); currentBitrate.setForeground(fgColor); bitrateBuilder.add(currentBitrate, FormLayoutUtil.flip(cc.xy(3, 3), bitColSpec, orientation)); peakBitrateLabel = new JLabel(Messages.getString("StatusTab.15")); peakBitrateLabel.setForeground(fgColor); bitrateBuilder.add(peakBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 5), bitColSpec, orientation)); peakBitrate = new JLabel("0"); peakBitrate.setForeground(fgColor); bitrateBuilder.add(peakBitrate, FormLayoutUtil.flip(cc.xy(3, 5), bitColSpec, orientation)); builder.add(bitrateBuilder.getPanel(), FormLayoutUtil.flip(cc.xywh(5, 7, 1, 3, "left, top"), colSpec, orientation)); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setBorder(BorderFactory.createEmptyBorder()); startMemoryUpdater(); return scrollPane; }
From source file:org.opendatakit.briefcase.ui.settings.SettingsPanelForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL/*from w w w.ja v a 2s . c o m*/ */ private void $$$setupUI$$$() { createUIComponents(); container = new JPanel(); container.setLayout(new GridBagLayout()); storageLocationContainer = new JPanel(); storageLocationContainer.setLayout(new GridBagLayout()); GridBagConstraints gbc; gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 5; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(storageLocationContainer, gbc); storageLocationLabel = new JLabel(); storageLocationLabel.setText("Storage Location"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; storageLocationContainer.add(storageLocationLabel, gbc); storageLocationField = new JTextField(); storageLocationField.setEditable(false); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; storageLocationContainer.add(storageLocationField, gbc); storageLocationButtons = new JPanel(); storageLocationButtons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 0; gbc.fill = GridBagConstraints.BOTH; storageLocationContainer.add(storageLocationButtons, gbc); storageLocationClearButton = new JButton(); storageLocationClearButton.setText("Clear"); storageLocationClearButton.setVisible(false); storageLocationButtons.add(storageLocationClearButton); storageLocationChooseButton = new JButton(); storageLocationChooseButton.setText("Choose..."); storageLocationButtons.add(storageLocationChooseButton); final JPanel spacer1 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; storageLocationContainer.add(spacer1, gbc); pullInParallelField = new JCheckBox(); pullInParallelField.setText("Pull submissions in parallel (experimental)"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 5; gbc.anchor = GridBagConstraints.WEST; container.add(pullInParallelField, gbc); rememberPasswordsField = new JCheckBox(); rememberPasswordsField.setText("Remember passwords (unencrypted)"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 7; gbc.gridwidth = 5; gbc.anchor = GridBagConstraints.WEST; container.add(rememberPasswordsField, gbc); sendUsageDataField = new JCheckBox(); sendUsageDataField.setText("Send usage data and crash logs to core developers"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 9; gbc.gridwidth = 5; gbc.anchor = GridBagConstraints.WEST; container.add(sendUsageDataField, gbc); useHttpProxyField = new JCheckBox(); useHttpProxyField.setText("Use HTTP Proxy"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 11; gbc.gridwidth = 5; gbc.anchor = GridBagConstraints.WEST; container.add(useHttpProxyField, gbc); final JPanel spacer2 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 12; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 0, 20); container.add(spacer2, gbc); httpProxyJostLabel = new JLabel(); httpProxyJostLabel.setText("Host"); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 12; gbc.anchor = GridBagConstraints.WEST; container.add(httpProxyJostLabel, gbc); httpProxyHostField = new JTextField(); httpProxyHostField.setPreferredSize(new Dimension(150, 30)); httpProxyHostField.setText("127.0.0.1"); gbc = new GridBagConstraints(); gbc.gridx = 4; gbc.gridy = 12; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(httpProxyHostField, gbc); final JPanel spacer3 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 12; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(spacer3, gbc); httpProxyPortLabel = new JLabel(); httpProxyPortLabel.setText("Port"); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 13; gbc.anchor = GridBagConstraints.WEST; container.add(httpProxyPortLabel, gbc); final JPanel spacer4 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 5; gbc.gridy = 12; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(spacer4, gbc); httpProxyPortField.setPreferredSize(new Dimension(150, 30)); gbc = new GridBagConstraints(); gbc.gridx = 4; gbc.gridy = 13; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(httpProxyPortField, gbc); final JPanel spacer5 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 10; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer5, gbc); final JPanel spacer6 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 6; gbc.gridy = 1; gbc.gridheight = 13; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(spacer6, gbc); final JPanel spacer7 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.gridheight = 13; gbc.fill = GridBagConstraints.HORIZONTAL; container.add(spacer7, gbc); final JPanel spacer8 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer8, gbc); final JPanel spacer9 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 14; gbc.gridwidth = 5; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer9, gbc); final JPanel spacer10 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 8; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer10, gbc); final JPanel spacer11 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer11, gbc); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 15; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.BOTH; container.add(panel1, gbc); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Troubleshooting")); reloadCacheButton = new JButton(); reloadCacheButton.setEnabled(false); reloadCacheButton.setText("Reload forms from storage location"); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 8; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(reloadCacheButton, gbc); final JPanel spacer12 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 7; gbc.fill = GridBagConstraints.VERTICAL; panel1.add(spacer12, gbc); final JPanel spacer13 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 9; gbc.fill = GridBagConstraints.VERTICAL; panel1.add(spacer13, gbc); final JPanel spacer14 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 8; gbc.weightx = 0.5; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(spacer14, gbc); final JPanel spacer15 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 8; gbc.weightx = 0.5; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(spacer15, gbc); final JLabel label1 = new JLabel(); label1.setText("The form list in Briefcase can get out of date if files are moved manually."); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.WEST; panel1.add(label1, gbc); final JLabel label2 = new JLabel(); label2.setText("This reload is always safe."); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.WEST; panel1.add(label2, gbc); final JPanel spacer16 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(spacer16, gbc); final JPanel spacer17 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.fill = GridBagConstraints.VERTICAL; panel1.add(spacer17, gbc); final JPanel spacer18 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 4; gbc.gridy = 5; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(spacer18, gbc); final JPanel spacer19 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 4; gbc.fill = GridBagConstraints.VERTICAL; panel1.add(spacer19, gbc); cleanAllPullResumePointsButton = new JButton(); cleanAllPullResumePointsButton.setEnabled(false); cleanAllPullResumePointsButton.setText("Clear pull history"); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; panel1.add(cleanAllPullResumePointsButton, gbc); final JLabel label3 = new JLabel(); label3.setText("Use if you wish to pull every submission, regardless of last submission pulled."); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.WEST; panel1.add(label3, gbc); final JPanel spacer20 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 2; gbc.fill = GridBagConstraints.VERTICAL; panel1.add(spacer20, gbc); final JPanel spacer21 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 16; gbc.gridwidth = 6; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer21, gbc); resumeLastPullField = new JCheckBox(); resumeLastPullField.setText("Start pull from last submission pulled"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 5; gbc.anchor = GridBagConstraints.WEST; container.add(resumeLastPullField, gbc); final JPanel spacer22 = new JPanel(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.gridwidth = 5; gbc.fill = GridBagConstraints.VERTICAL; container.add(spacer22, gbc); }
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 w ww .j a v a2 s . co m*/ 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:greenfoot.gui.export.ExportPublishPane.java
/** * Creates a login panel with a username and password and a create account option * @return Login panel Component// www .ja v a 2s . c om */ private JComponent getLoginPanel() { JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4)); loginPanel.setBackground(background); loginPanel.setAlignmentX(LEFT_ALIGNMENT); Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12)); loginPanel.setBorder(border); JLabel text = new JLabel(Config.getString("export.publish.login")); text.setForeground(headingColor); text.setVerticalAlignment(SwingConstants.TOP); loginPanel.add(text); text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); userNameField = new JTextField(10); userNameField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { String text = userNameField.getText(); return text.length() > 0; } }); userNameField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { checkForExistingScenario(); } }); loginPanel.add(userNameField); text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); passwordField = new JPasswordField(10); loginPanel.add(passwordField); JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount")); { createAccountLabel.setBackground(background); createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT); GreenfootUtil.makeLink(createAccountLabel, createAccountUrl); } loginPanel.add(createAccountLabel); return loginPanel; }
From source file:rita.ui.component.DialogSelectEnemies.java
/** * Initialize the contents of the frame. * //from w w w .ja v a2s. co m * @throws NoEnemiesException */ private void initialize() throws NoEnemiesException { this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.getContentPane().setLayout(new BorderLayout(6, 6)); this.setTitle(Language.get("selectEnemies")); randomMode = new JCheckBox(Language.get("robotsBattleMode.random")); randomMode.setSelected(true); randomMode.addActionListener(new SelectUnselectPositionAction()); icon = new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/target.jpg")); JPanel panelRobots = new JPanel(); panelRobots.setBorder(new EmptyBorder(0, 12, 12, 0)); panelRobots.setLayout(new BorderLayout(0, 0)); JPanel panelSelectAllNone = new JPanel(); panelSelectAllNone.setBorder(new EmptyBorder(0, 12, 0, 12)); panelRobots.add(panelSelectAllNone, BorderLayout.EAST); this.getContentPane().add(panelRobots, BorderLayout.CENTER); GridBagLayout gbl_panelSelectAllNone = new GridBagLayout(); gbl_panelSelectAllNone.columnWidths = new int[] { 0, 0 }; gbl_panelSelectAllNone.rowHeights = new int[] { 0, 0, 8 }; gbl_panelSelectAllNone.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl_panelSelectAllNone.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; panelSelectAllNone.setLayout(gbl_panelSelectAllNone); JButton btnSelectAll = new JButton(Language.get("selectAllEnemies")); GridBagConstraints gbc_btnSelectAll = new GridBagConstraints(); gbc_btnSelectAll.fill = GridBagConstraints.HORIZONTAL; gbc_btnSelectAll.insets = new Insets(0, 0, 5, 0); gbc_btnSelectAll.gridx = 0; gbc_btnSelectAll.gridy = 0; panelSelectAllNone.add(btnSelectAll, gbc_btnSelectAll); JButton btnSelectNone = new JButton(Language.get("selectNoEnemies")); GridBagConstraints gbc_btnSelectNone = new GridBagConstraints(); gbc_btnSelectNone.fill = GridBagConstraints.HORIZONTAL; gbc_btnSelectNone.gridx = 0; gbc_btnSelectNone.gridy = 1; panelSelectAllNone.add(btnSelectNone, gbc_btnSelectNone); /* * btnInitialPositionsConfig = new * JButton(Language.get("selectRobotsInitialPositions")); * GridBagConstraints gbc_btnInitialPositionsConfig = new * GridBagConstraints(); gbc_btnSelectNone.fill = * GridBagConstraints.HORIZONTAL; gbc_btnSelectNone.gridx = 0; * gbc_btnSelectNone.gridy = 1; * panelSelectAllNone.add(btnInitialPositionsConfig, * gbc_btnInitialPositionsConfig); * btnInitialPositionsConfig.addActionListener(new ActionListener() { * public void actionPerformed(ActionEvent evt) { * selectRobotsInitialPositions(); } }); */ JLabel label = new JLabel(String.format(Language.get("youtRobotAgainst"), HelperEditor.currentRobotName)); label.setBorder(new EmptyBorder(12, 12, 0, 12)); label.setIcon(new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/compite2.png"))); label.setVerticalAlignment(SwingConstants.TOP); label.setFont(label.getFont().deriveFont(Font.BOLD, 14)); panelSelectRobots = new JPanel(); panelSelectRobots.setLayout(new GridLayout(0, 2)); panelSelectRobots.setAutoscrolls(true); panelRobots.add(label, BorderLayout.NORTH); panelRobots.add(panelSelectRobots, BorderLayout.CENTER); // posicion de mi robot JPanel panelSetMyRobotPosition = new JPanel(); // panelRobots.add(panelSetMyRobotPosition, BorderLayout.PAGE_END); panelSetMyRobotPosition.setLayout(new FlowLayout()); JLabel ownPosition = new JLabel(Language.get("myRobotPosition") + " " + HelperEditor.currentRobotName); ownPosition.setFont(new Font("sansserif", Font.BOLD, 12)); panelSetMyRobotPosition.add(ownPosition); // Posicion de mi robot buttonPos = new JButton(icon); buttonPos.addActionListener(new PosicionRobotAction(HelperEditor.currentRobotName)); // el nombre aqui es solo a // modo informativo buttonPos.setPreferredSize(new Dimension(30, 30)); panelSetMyRobotPosition.add(buttonPos); positionComponents.add(buttonPos); // Matas JPanel panelSelectRoundsNumber = new JPanel(); // panelRobots.add(panelSelectRoundsNumber, BorderLayout.SOUTH); panelSelectRoundsNumber.setLayout(new FlowLayout()); panelSelectRoundsNumber.add(new JLabel(Language.get("selectRoundsNumber"))); // this.roundsNumberTextField = new JTextField( // Integer.toString(Batalla.NUMBER_OF_ROUNDS), 5); this.roundsNumberSpinner = new JSpinner(new SpinnerNumberModel(Batalla.NUMBER_OF_ROUNDS, Batalla.MIN_NUMBER_OF_ROUNDS, Batalla.MAX_NUMBER_OF_ROUNDS, 1)); panelSelectRoundsNumber.add(this.roundsNumberSpinner); JPanel panelSouth = new JPanel(); panelSouth.setLayout(new GridLayout(4, 1)); panelSouth.add(panelSetMyRobotPosition); //this.getContentPane().add(randomMode, BorderLayout.SOUTH); panelSouth.add(randomMode); panelSouth.add(new JSeparator()); panelSouth.add(panelSelectRoundsNumber); panelRobots.add(panelSouth, BorderLayout.SOUTH); JPanel panelOkCancel = new JPanel(); this.getContentPane().add(panelOkCancel, BorderLayout.SOUTH); panelOkCancel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 12)); btnOK = new JButton(Language.get("selectStartBattle")); btnOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startBattle(panelSelectRobots); } }); // comienza deshabilitado hasta que se seleccione 1 enemigo // btnOK.setEnabled(false); panelOkCancel.add(btnOK); JButton btnCancel = new JButton(Language.get("cancel")); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeDialog(); } }); panelOkCancel.add(btnCancel); btnSelectAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { selectChecks(panelSelectRobots, true); // btnOK.setEnabled(true); } }); btnSelectNone.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { selectChecks(panelSelectRobots, false); // btnOK.setEnabled(false); } }); // TODO Agregar funcionalidad de elegir las posiciones iniciales de los // robots. // TODO Averiguar como pasar las posiciones para que se elijan de manera // random, probar (0,0,0) try { robotNameClicked = new RobotNameClickedEvent(btnOK); addRobotsToPanel(panelSelectRobots); this.setResizable(false); this.pack(); PositionCalc.centerDialog(this); enablePositionOptions(false); this.setVisible(true); } catch (FileNotFoundException e) { throw new NoEnemiesException(e.getMessage()); } }
From source file:com.limegroup.gnutella.gui.GUIUtils.java
/** * Centers the given component.//from w w w. jav a 2s . c o m */ public static JPanel center(JComponent c) { JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); p.add(c); return p; }
From source file:org.datacleaner.panels.WelcomePanel.java
private JComponent createButtonPanel() { final String newJobText = SystemProperties.getString(SystemProperties.UI_DESKTOP_TEXT_NEW_JOB_BUTTON, "Build new job"); final JButton newJobButton = WidgetFactory.createPrimaryButton(newJobText, IconUtils.MODEL_JOB); newJobButton.addActionListener(new ActionListener() { @Override//from w ww . j a va 2 s .c o m public void actionPerformed(ActionEvent e) { getWindow().changePanel(AnalysisWindowPanelType.SELECT_DS); } }); final PopupButton recentJobsButton = WidgetFactory.createDefaultPopupButton("Recent jobs", IconUtils.FILE_HOME_FOLDER); recentJobsButton.setMenuPosition(MenuPosition.TOP); recentJobsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { refreshRecentJobs(recentJobsButton); } }); final JButton browseJobsButton = WidgetFactory.createDefaultButton("Browse jobs", IconUtils.FILE_FOLDER); browseJobsButton.addActionListener(_openAnalysisJobActionListener); final JButton manageDatastoresButton = WidgetFactory.createDefaultButton("Manage datastores", IconUtils.GENERIC_DATASTORE_IMAGEPATH); manageDatastoresButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getWindow().changePanel(AnalysisWindowPanelType.MANAGE_DS); } }); final DCPanel buttonPanel = new DCPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); buttonPanel.add(newJobButton); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(browseJobsButton); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(recentJobsButton); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(manageDatastoresButton); buttonPanel.setBorder(new EmptyBorder(0, 0, 20, 0)); return wrapContent(buttonPanel); }
From source file:eu.apenet.dpt.standalone.gui.ead2edm.EdmOptionsPanel.java
private void createOptionPanel() { labels = dataPreparationToolGUI.getLabels(); JPanel creativeCommonsPanel = new CreativeCommonsPanel(); JPanel europeanaRightsPanel = new EuropeanaRightsPanel(); JPanel emptyPanel = new JPanel(); JPanel formPanel = new JPanel(new GridLayout(14, 1)); JPanel extraLicenseCardLayoutPanel = new JPanel(new CardLayout()); extraLicenseCardLayoutPanel.add(creativeCommonsPanel, CREATIVE_COMMONS); extraLicenseCardLayoutPanel.add(europeanaRightsPanel, EUROPEANA_RIGHTS_STATEMENTS); extraLicenseCardLayoutPanel.add(emptyPanel, EMPTY_PANEL); CardLayout cardLayout = (CardLayout) extraLicenseCardLayoutPanel.getLayout(); cardLayout.show(extraLicenseCardLayoutPanel, EMPTY_PANEL); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); conversionModeGroup = new ButtonGroup(); JRadioButton radioButton;//from w w w .ja va2 s.com panel.add(new Label(this.labels.getString("edm.panel.label.choose.mode"))); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.minimal")); radioButton.setActionCommand(MINIMAL); radioButton.setSelected(true); radioButton.addActionListener(new ConversionModeListener()); conversionModeGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.full")); radioButton.setActionCommand(FULL); radioButton.addActionListener(new ConversionModeListener()); conversionModeGroup.add(radioButton); panel.add(radioButton); formPanel.add(panel); panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); cLevelIdSourceButtonGroup = new ButtonGroup(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.identifierSource.header"))); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.unitid")); radioButton.setActionCommand(UNITID); if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) { radioButton.setSelected(true); } cLevelIdSourceButtonGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.cid")); radioButton.setActionCommand(CID); if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) { radioButton.setSelected(true); } cLevelIdSourceButtonGroup.add(radioButton); panel.add(radioButton); formPanel.add(panel); panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); sourceOfFondsTitleGroup = new ButtonGroup(); determineDaoInformation(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle"))); if (!this.batch && StringUtils.isBlank(ead2EdmInformation.getArchdescUnittitle()) && StringUtils.isBlank(ead2EdmInformation.getTitlestmtTitleproper())) { panel.add(new Label( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.noSourceAvailable"))); } else { radioButton = new JRadioButton( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.archdescUnittitle")); radioButton.setActionCommand(ARCHDESC_UNITTITLE); radioButton.setSelected(true); radioButton.addActionListener(new ConversionModeListener()); sourceOfFondsTitleGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.titlestmtTitleproper")); radioButton.setActionCommand(TITLESTMT_TITLEPROPER); radioButton.addActionListener(new ConversionModeListener()); sourceOfFondsTitleGroup.add(radioButton); panel.add(radioButton); } formPanel.add(panel); panel = new JPanel(new GridLayout(2, 2)); landingPageButtonGroup = new ButtonGroup(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.landingPages.header"))); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.ape")); radioButton.setActionCommand(APE); if (retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) { radioButton.setSelected(true); } landingPageButtonGroup.add(radioButton); panel.add(radioButton); panel.add(new Label()); JPanel otherPanel = new JPanel(new GridLayout(1, 2)); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.other")); radioButton.setActionCommand(OTHER); landingPageButtonGroup.add(radioButton); otherPanel.add(radioButton); landingPageTextArea = new JTextArea(); landingPageTextArea.setLineWrap(true); landingPageTextArea.setWrapStyleWord(true); if (!retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) { radioButton.setSelected(true); landingPageTextArea.setText(retrieveFromDb.retrieveLandingPageBase()); } JScrollPane lptaScrollPane = new JScrollPane(landingPageTextArea); lptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); otherPanel.add(lptaScrollPane); panel.add(otherPanel); formPanel.add(panel); panel = new JPanel(new GridLayout(1, 1)); panel.add(new Label(labels.getString("ese.mandatoryFieldsInfo"))); panel.add(new Label("")); panel.setBorder(BLACK_LINE); formPanel.add(panel); panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.dataProvider") + ":" + "*")); dataProviderTextArea = new JTextArea(); dataProviderTextArea.setLineWrap(true); dataProviderTextArea.setWrapStyleWord(true); JScrollPane dptaScrollPane = new JScrollPane(dataProviderTextArea); dptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(dptaScrollPane); useExistingRepoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileRepository")); useExistingRepoCheckbox.setSelected(true); useExistingRepoCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); JPanel panel2 = new JPanel(new GridLayout(1, 1)); panel2.add(useExistingRepoCheckbox); if (!batch) { String repository = ead2EdmInformation.getRepository(); if (repository != null && !repository.equals("")) { dataProviderTextArea.setText(repository); } else { if (archdescRepository != null) { dataProviderTextArea.setText(archdescRepository); } else { useExistingRepoCheckbox.setSelected(false); } } } panel.add(panel2); panel.setBorder(BLACK_LINE); formPanel.add(panel); /* panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.provider") + ":" + "*")); providerTextArea = new JTextArea(); providerTextArea.setLineWrap(true); providerTextArea.setWrapStyleWord(true); JScrollPane ptaScrollPane = new JScrollPane(providerTextArea); ptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(ptaScrollPane); panel.add(new Label("")); panel.setBorder(BLACK_LINE); formPanel.add(panel); */ panel = new JPanel(new GridLayout(5, 3)); typeGroup = new ButtonGroup(); panel.add(new Label(labels.getString("ese.type") + ":" + "*")); String currentRoleType; if (batch) { currentRoleType = ""; } else { currentRoleType = ead2EdmInformation.getRoleType(); } radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.text")); if (currentRoleType.equals(EdmOptionsPanel.TEXT)) { radioButton.setSelected(true); } radioButton.setActionCommand(TEXT); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.image")); if (currentRoleType.equals(EdmOptionsPanel.IMAGE)) { radioButton.setSelected(true); } radioButton.setActionCommand(IMAGE); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.video")); if (currentRoleType.equals(EdmOptionsPanel.VIDEO)) { radioButton.setSelected(true); } radioButton.setActionCommand(VIDEO); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); useExistingDaoRoleCheckbox = new JCheckBox(labels.getString("ese.takeFromFileDaoRole")); useExistingDaoRoleCheckbox.setSelected(true); useExistingDaoRoleCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { } }); panel.add(useExistingDaoRoleCheckbox); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.sound")); if (currentRoleType.equals(EdmOptionsPanel.SOUND)) { radioButton.setSelected(true); } radioButton.setActionCommand(SOUND); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.threed")); if (currentRoleType.equals(EdmOptionsPanel.THREE_D)) { radioButton.setSelected(true); } radioButton.setActionCommand(THREE_D); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.setBorder(GREY_LINE); formPanel.add(panel); if (this.batch) { panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.selectLanguage") + ":" + "*")); panel.add(languageBoxPanel); useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage")); useExistingLanguageCheckbox.setSelected(true); useExistingLanguageCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); panel.add(useExistingLanguageCheckbox); panel.setBorder(BLACK_LINE); formPanel.add(panel); } else { inheritLanguagePanel = new JPanel(new GridLayout(1, 3)); inheritLanguagePanel.add(new Label(labels.getString("ese.inheritLanguage") + ":" + "*")); JPanel rbPanel = new JPanel(new GridLayout(4, 1)); inheritLanguageGroup = new ButtonGroup(); inhLanYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhLanYesRadioButton.setActionCommand(YES); inhLanYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanYesRadioButton); rbPanel.add(inhLanYesRadioButton); inhLanNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhLanNoRadioButton.setActionCommand(NO); inhLanNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanNoRadioButton); rbPanel.add(inhLanNoRadioButton); inhLanProvideRadioButton = new JRadioButton(labels.getString("ese.provide")); inhLanProvideRadioButton.setActionCommand(PROVIDE); inhLanProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanProvideRadioButton); rbPanel.add(inhLanProvideRadioButton); useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage")); useExistingLanguageCheckbox.setSelected(true); useExistingLanguageCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); rbPanel.add(useExistingLanguageCheckbox); inheritLanguagePanel.add(rbPanel, BorderLayout.WEST); languageBoxPanel.setVisible(true); inheritLanguagePanel.add(languageBoxPanel, BorderLayout.EAST); inheritLanguagePanel.setBorder(BLACK_LINE); inheritLanguagePanel.setVisible(true); formPanel.add(inheritLanguagePanel); } // if (this.batch) { panel = new JPanel(new GridLayout(1, 3)); panel.add(new JLabel(labels.getString("edm.panel.license.inheritLicense") + ":" + "*")); useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense")); useExistingRightsInfoCheckbox.setSelected(true); useExistingRightsInfoCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); panel.add(useExistingRightsInfoCheckbox); panel.add(new JLabel()); panel.setBorder(BLACK_LINE); panel.setVisible(true); formPanel.add(panel); // } else { // panel = new JPanel(new GridLayout(3, 3)); // inheritLicenseGroup = new ButtonGroup(); // // panel.add(new Label(labels.getString("edm.panel.license.inheritLicense") + ":" + "*")); // inhLicYesRadioButton = new JRadioButton(labels.getString("ese.yes")); // inhLicYesRadioButton.setActionCommand(YES); //// inhLicYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicYesRadioButton); // panel.add(inhLicYesRadioButton); // panel.add(new JLabel()); // // panel.add(new JLabel()); // inhLicNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); // inhLicNoRadioButton.setActionCommand(NO); //// inhLicNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicNoRadioButton); // panel.add(inhLicNoRadioButton); // useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense")); // useExistingRightsInfoCheckbox.setSelected(true); // useExistingRightsInfoCheckbox.addItemListener(new ItemListener() { // @Override // public void itemStateChanged(ItemEvent e) { // //empty method on purpose // } // }); // // panel.add(useExistingRightsInfoCheckbox); // // panel.add(new JLabel()); // inhLicProvideRadioButton = new JRadioButton(labels.getString("ese.provide")); // inhLicProvideRadioButton.setActionCommand(PROVIDE); //// inhLicProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicProvideRadioButton); // panel.add(inhLicProvideRadioButton); // panel.add(new JLabel()); // // panel.setBorder(BLACK_LINE); // panel.setVisible(true); // formPanel.add(panel); // } JPanel mainLicensePanel = new JPanel(new BorderLayout()); panel = new JPanel(new GridLayout(5, 2)); licenseGroup = new ButtonGroup(); // String currentRightsInformation; // if (batch) { // currentRightsInformation = ""; // } else { // currentRightsInformation = ead2EdmInformation.getArchdescLicenceType(); // } panel.add(new Label(labels.getString("ese.specifyLicense") + ":" + "*")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.zero")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_CC0)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS_CC0); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.public")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.europeana.rights")); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(EUROPEANA_RIGHTS_STATEMENTS); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.out.copyright")); // if (currentRightsInformation.equals(EdmOptionsPanel.OUT_OF_COPYRIGHT)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(EdmOptionsPanel.OUT_OF_COPYRIGHT); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); mainLicensePanel.add(panel, BorderLayout.WEST); mainLicensePanel.add(extraLicenseCardLayoutPanel, BorderLayout.EAST); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS) || currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // cardLayout.show(extraLicenseCardLayoutPanel, currentRightsInformation); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) { // if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-f/")) { // europeanaRightsComboBox.setSelectedIndex(0); // } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("orphan-work-eu/")) { // europeanaRightsComboBox.setSelectedIndex(1); // } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-p/")) { // europeanaRightsComboBox.setSelectedIndex(2); // } else { // europeanaRightsComboBox.setSelectedIndex(3); // } // } else if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // // get respective items from EAD2EDMInfo and set panel items appropriately // } // } mainLicensePanel.setBorder(BLACK_LINE); formPanel.add(mainLicensePanel); panel = new JPanel(new GridLayout(1, 1)); panel.add(new Label(labels.getString("ese.specifyAdditionalRightsInfo") + ":")); additionalRightsTextArea = new JTextArea(); additionalRightsTextArea.setLineWrap(true); additionalRightsTextArea.setWrapStyleWord(true); JScrollPane artaScrollPane = new JScrollPane(additionalRightsTextArea); artaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(artaScrollPane); panel.setBorder(GREY_LINE); formPanel.add(panel); inheritParentPanel = new JPanel(new GridLayout(2, 3)); inheritParentCheckbox = new JCheckBox(labels.getString("ese.inheritParent") + ":" + "*"); inheritParentCheckbox.setSelected(true); inheritParentCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhParYesRadioButton.setEnabled(true); inhParNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhParYesRadioButton.setEnabled(false); inhParNoRadioButton.setEnabled(false); } } }); inheritParentPanel.add(inheritParentCheckbox); inheritParentGroup = new ButtonGroup(); inhParYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhParYesRadioButton.setActionCommand(YES); inheritParentGroup.add(inhParYesRadioButton); inheritParentPanel.add(inhParYesRadioButton); inheritParentPanel.add(new JLabel("")); inhParNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhParNoRadioButton.setActionCommand(NO); inheritParentGroup.add(inhParNoRadioButton); inheritParentPanel.add(inhParNoRadioButton); inheritParentPanel.setBorder(GREY_LINE); inheritParentPanel.setVisible(false); formPanel.add(inheritParentPanel); inheritOriginationPanel = new JPanel(new GridLayout(2, 3)); inheritOriginationCheckbox = new JCheckBox(labels.getString("ese.inheritOrigination") + ":" + "*"); inheritOriginationCheckbox.setSelected(true); inheritOriginationCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhOriYesRadioButton.setEnabled(true); inhOriNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhOriYesRadioButton.setEnabled(false); inhOriNoRadioButton.setEnabled(false); } } }); inheritOriginationPanel.add(inheritOriginationCheckbox); inheritOriginationGroup = new ButtonGroup(); inhOriYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhOriYesRadioButton.setActionCommand(YES); inheritOriginationGroup.add(inhOriYesRadioButton); inheritOriginationPanel.add(inhOriYesRadioButton); inheritOriginationPanel.add(new JLabel("")); inhOriNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhOriNoRadioButton.setActionCommand(NO); inheritOriginationGroup.add(inhOriNoRadioButton); inheritOriginationPanel.add(inhOriNoRadioButton); inheritOriginationPanel.setBorder(BLACK_LINE); inheritOriginationPanel.setVisible(false); formPanel.add(inheritOriginationPanel); inheritUnittitlePanel = new JPanel(new GridLayout(2, 3)); inheritUnittitleCheckbox = new JCheckBox(labels.getString("ese.inheritUnittitle") + ":" + "*"); inheritUnittitleCheckbox.setSelected(true); inheritUnittitleCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhTitleYesRadioButton.setEnabled(true); inhTitleNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhTitleYesRadioButton.setEnabled(false); inhTitleNoRadioButton.setEnabled(false); } } }); inheritUnittitlePanel.add(inheritUnittitleCheckbox); inheritUnittitleGroup = new ButtonGroup(); inhTitleYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhTitleYesRadioButton.setActionCommand(YES); inheritUnittitleGroup.add(inhTitleYesRadioButton); inheritUnittitlePanel.add(inhTitleYesRadioButton); inheritUnittitlePanel.add(new JLabel("")); inhTitleNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhTitleNoRadioButton.setActionCommand(NO); inheritUnittitleGroup.add(inhTitleNoRadioButton); inheritUnittitlePanel.add(inhTitleNoRadioButton); inheritUnittitlePanel.setBorder(BLACK_LINE); inheritUnittitlePanel.setVisible(false); formPanel.add(inheritUnittitlePanel); JButton createEdmBtn = new JButton(labels.getString("ese.createEseBtn")); JButton cancelBtn = new JButton(labels.getString("ese.cancelBtn")); createEdmBtn.addActionListener(new CreateEdmActionListener()); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (Map.Entry<String, FileInstance> entry : fileInstances.entrySet()) { FileInstance fileInstance = entry.getValue(); fileInstance.setEdm(false); } dataPreparationToolGUI.enableEdmConversionBtn(); if (batch) { dataPreparationToolGUI.enableAllBatchBtns(); } dataPreparationToolGUI.enableRadioButtons(); close(); } }); JPanel buttonPanel = new JPanel(new GridLayout(1, 5)); buttonPanel.add(new JLabel("")); buttonPanel.add(cancelBtn); buttonPanel.add(new JLabel("")); buttonPanel.add(createEdmBtn); buttonPanel.add(new JLabel("")); add(formPanel, BorderLayout.CENTER); add(buttonPanel, BorderLayout.SOUTH); }
From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java
/** * @param loadChooser//from w ww . ja v a 2 s .c o m * @return */ public Component createBottomPanel() { loadChooser = new JFileChooser(); loadChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Script Files"; } @Override public boolean accept(File f) { return f.isDirectory() || ConfiguredLanguage.getConfiguredExtensions() .contains(FilenameUtils.getExtension(f.getName())); } }); runBT = new JButton("Run Script"); runBT.setEnabled(false); runBT.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { runScript(); } }); JButton chooseBT = new JButton("Open Script..."); chooseBT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { loadScript(); } }); JButton saveScriptBT = new JButton("Save Script..."); saveScriptBT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveScript(false); } }); JButton saveAsScriptBT = new JButton("Save Script As..."); saveAsScriptBT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveScript(true); } }); JButton localBT = new JButton("Toggle Storage Mode"); localBT.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { toggleStorageMode(); } }); localLB = new JLabel(); setLocalLable(); JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); bottomPanel.add(runBT); bottomPanel.add(chooseBT); bottomPanel.add(saveScriptBT); bottomPanel.add(saveAsScriptBT); bottomPanel.add(localLB); bottomPanel.add(localBT); return bottomPanel; }
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 ======== {//from w w w .j a va2 s . com 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); }