List of usage examples for java.awt FlowLayout LEFT
int LEFT
To view the source code for java.awt FlowLayout LEFT.
Click Source Link
From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java
private void addSignatureTab(JTabbedPane tabbedPane) { GridBagLayout gridBagLayout = new GridBagLayout(); JPanel dataPanel = new JPanel(gridBagLayout); JPanel signaturePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); tabbedPane.add("Signature", new JScrollPane(signaturePanel)); signaturePanel.add(dataPanel);//from www .ja v a2 s . c o m GridBagConstraints constraints = new GridBagConstraints(); JLabel signerLabel = new JLabel("Signer"); constraints.anchor = GridBagConstraints.FIRST_LINE_START; constraints.gridx = 0; constraints.gridy = 0; constraints.ipadx = 10; dataPanel.add(signerLabel, constraints); this.signer = new JLabel(); constraints.gridx++; dataPanel.add(this.signer, constraints); JLabel signerSha1FingerprintLabel = new JLabel("Public key SHA1 fingerprint:"); constraints.gridx = 0; constraints.gridy++; dataPanel.add(signerSha1FingerprintLabel, constraints); this.signerSha1Fingerprint = new JLabel(); constraints.gridx++; dataPanel.add(this.signerSha1Fingerprint, constraints); JLabel signerSha256FingerprintLabel = new JLabel("Public key SHA256 fingerprint:"); constraints.gridx = 0; constraints.gridy++; dataPanel.add(signerSha256FingerprintLabel, constraints); this.signerSha256Fingerprint = new JLabel(); constraints.gridx++; dataPanel.add(this.signerSha256Fingerprint, constraints); this.saveSignerCertificateButton = new JButton("Save Certificate..."); constraints.gridx = 0; constraints.gridy++; dataPanel.add(this.saveSignerCertificateButton, constraints); this.saveSignerCertificateButton.addActionListener(this); this.saveSignerCertificateButton.setEnabled(false); updateView(); }
From source file:org.kuali.test.ui.components.panels.HtmlCheckpointPanel.java
private void initComponents(HtmlDomProcessor.DomInformation dominfo) { if (dominfo != null) { setName(Constants.DEFAULT_HTML_PROPERTY_GROUP); checkPointMap = loadCheckpointMap(dominfo.getCheckpointProperties()); if (LOG.isDebugEnabled()) { LOG.debug("labelNodes.size(): " + dominfo.getLabelMap().size()); LOG.debug("CheckpointProperty list size: " + dominfo.getCheckpointProperties().size()); LOG.debug("CheckpointProperty map.size: " + checkPointMap.size()); }/*ww w .j a va 2s . c om*/ // if we have more than 1 group then we will use tabs if (checkPointMap.size() > 1) { if (isUseTabContainers()) { JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); p.add(containers = new JComboBox(getContainerNames())); add(p, BorderLayout.NORTH); containers.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadTabs(); } }); } add(tabbedPane = new JTabbedPane(), BorderLayout.CENTER); loadTabs(); } else if (checkPointMap.size() == 1) { CheckpointTable t; String key = checkPointMap.keySet().iterator().next(); if (singleSelectMode) { t = buildParameterTableForSingleSelect(key, checkPointMap.get(key)); } else { t = buildParameterTable(key, checkPointMap.get(key)); } TablePanel p = new TablePanel(t); t.getSelectionModel().addListSelectionListener(this); add(p, BorderLayout.CENTER); } else { add(new JLabel("No checkpoint properties found", JLabel.CENTER), BorderLayout.CENTER); empty = true; } } else { UIUtils.showError(parentDialog, "HTML Parse Error", "Unable to parse web browser HTML"); } parentDialog.validate(); }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java
/** * Creates a row./*from w w w . ja v a 2s . co m*/ * * @return See above. */ private JPanel createRow() { JPanel row = new JPanel(); row.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); row.add(getLabel()); row.add(getComponent()); setComponentColor(row, ScriptingDialog.BG_COLOR); return row; }
From source file:com.egangotri.transliteratorAsSwing.TransliteratorJFrame.java
public TransliteratorJFrame() { super("eGangotri Indic Transliterator"); PrintWriter pw = new PrintWriter(System.out, true); setSize(650, 650);/*from w w w . j a va 2 s . c om*/ // menubar menubar = new JMenuBar(); // menus file = new JMenu("File"); help = new JMenu("Help"); // JMenuItem save_1 = new JMenuItem("Save Input"); save_1.setActionCommand("save_1"); save_1.addActionListener(this); save_2 = new JMenuItem("Save Output-1"); save_2.setActionCommand("save_2"); save_2.addActionListener(this); save_3 = new JMenuItem("Save Output-2"); save_3.setActionCommand("save_3"); save_3.addActionListener(this); open_1 = new JMenuItem("Open File for Input"); open_1.setActionCommand("open_1"); open_1.addActionListener(this); exitItem = new JMenuItem("Exit"); exitItem.setActionCommand("Exit"); exitItem.addActionListener(this); aboutItem = new JMenuItem("About"); aboutItem.setActionCommand("about_item"); aboutItem.addActionListener(this); itransItem = new JMenuItem("ITRANS " + Constants.ENCODING_SCHEME); itransItem.setActionCommand("itrans_encoding"); itransItem.addActionListener(this); slpItem = new JMenuItem("SLP " + Constants.ENCODING_SCHEME); slpItem.setActionCommand("slp_encoding"); slpItem.addActionListener(this); hkItem = new JMenuItem("Harvard Kyoto " + Constants.ENCODING_SCHEME); hkItem.setActionCommand("hk_encoding"); hkItem.addActionListener(this); velthuisItem = new JMenuItem("Velthuis " + Constants.ENCODING_SCHEME); velthuisItem.setActionCommand("velthuis_encoding"); velthuisItem.addActionListener(this); dvnItem = new JMenuItem("Devanagari " + Constants.ENCODING_SCHEME); dvnItem.setActionCommand("devanagari_encoding"); dvnItem.addActionListener(this); iastItem = new JMenuItem("IAST " + Constants.ENCODING_SCHEME); iastItem.setActionCommand("iast_encoding"); iastItem.addActionListener(this); // add menuitems to menu file.add(open_1); file.add(save_1); file.add(save_2); file.add(save_3); file.add(exitItem); help.add(aboutItem); help.add(itransItem); help.add(slpItem); help.add(hkItem); help.add(velthuisItem); help.add(dvnItem); help.add(iastItem); // add menus to menubar menubar.add(file); menubar.add(help); // menus end // JPanel Initilization p1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p1a = new JPanel(new BorderLayout()); p2 = new JPanel(); p3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p3a = new JPanel(new BorderLayout()); p4 = new JPanel(); p5 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p5a = new JPanel(new BorderLayout()); p6 = new JPanel(); p6a = new JPanel(); p7 = new JPanel(); // JLabel Initialization label1 = new JLabel("Input:"); label2 = new JLabel("Output-1"); label3 = new JLabel("Output-2"); capitalize = new JCheckBox("Capitalize Extended Latin"); capitalize.setSelected(capitalizeIAST); capitalize.setActionCommand("capitalize"); capitalize.addActionListener(this); // Buttons clearButton = new JButton("Clear"); clearButton.setActionCommand("clear"); clearButton.setToolTipText("Clear all Fields"); refreshButton = new JButton("Refresh"); refreshButton.setActionCommand("refresh"); refreshButton.setToolTipText("Refesh the View"); exitButton = new JButton("Exit"); exitButton.setActionCommand("Exit"); exitButton.setToolTipText("Quit the Application."); clipboardButton1 = new JButton("Clipboard"); clipboardButton1.setActionCommand("clipboard-1"); clipboardButton1.setToolTipText("Clipboard Input"); clipboardButton2 = new JButton("Clipboard"); clipboardButton2.setActionCommand("clipboard-2"); clipboardButton2.setToolTipText("Clipboard Output-1"); clipboardButton3 = new JButton("Clipboard"); clipboardButton3.setActionCommand("clipboard-3"); clipboardButton3.setToolTipText("Clipboard Output-2"); clearButton.addActionListener(this); refreshButton.addActionListener(this); exitButton.addActionListener(this); clipboardButton1.addActionListener(this); clipboardButton2.addActionListener(this); clipboardButton3.addActionListener(this); Container contentPane = getContentPane(); // JTextBox tb1 = new JTextArea(new PlainDocument(), null, 6, 45); tb1.setLineWrap(true); tb1.setWrapStyleWord(true); tb1.addKeyListener(this); tb2 = new JTextArea(new PlainDocument(), null, 6, 45); tb2.setLineWrap(true); tb2.setWrapStyleWord(true); tb2.addKeyListener(this); tb3 = new JTextArea(new PlainDocument(), null, 6, 45); tb3.setLineWrap(true); tb3.setWrapStyleWord(true); tb3.addKeyListener(this); // Setting Fonts Font unicodeFont = new Font(Constants.ARIAL_UNICODE_MS, Font.PLAIN, Constants.FONT_SIZE); tb1.setFont(unicodeFont); tb2.setFont(unicodeFont); tb3.setFont(unicodeFont); comboBox1 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox1.setActionCommand("comboBox1"); comboBox1.setSelectedItem(Constants.ITRANS); comboBox1.addActionListener(this); comboBox2 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox2.setActionCommand("comboBox2"); comboBox2.setSelectedItem(Constants.UNICODE_DVN); comboBox2.addActionListener(this); comboBox3 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox3.setActionCommand("comboBox3"); comboBox3.setSelectedItem(Constants.IAST); comboBox3.addActionListener(this); /** *EXPERIMENT*** */ textPane = new JTextPane(); RTFEditorKit rtfkit = new RTFEditorKit(); // HTMLEditorKit htmlkit = new HTMLEditorKit(); textPane.setEditorKit(rtfkit); // set Kit which will read RTF Doc // textPane.setEditorKit(htmlkit); textPane.setEditable(false); // make uneditable textPane.setPreferredSize(new Dimension(200, 200)); textPane.setText(""); // set p1.add(label1); p1a.add(comboBox1, BorderLayout.LINE_END); p1a.add(clipboardButton1, BorderLayout.LINE_START); p2.add(new JScrollPane(tb1)); p3.add(label2); p3a.add(comboBox2, BorderLayout.LINE_END); p3a.add(clipboardButton2, BorderLayout.LINE_START); p4.add(new JScrollPane(tb2)); p5.add(label3); p5a.add(comboBox3, BorderLayout.LINE_END); p5a.add(clipboardButton3, BorderLayout.LINE_START); p6.add(new JScrollPane(tb3)); p6a.add(capitalize); p7.add(clearButton); p7.add(refreshButton); p7.add(exitButton); this.setJMenuBar(menubar); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(p1); contentPane.add(p1a); contentPane.add(p2); contentPane.add(p3); contentPane.add(p3a); contentPane.add(p4); contentPane.add(p5); contentPane.add(p5a); contentPane.add(p6); contentPane.add(p6a); contentPane.add(p7); }
From source file:VASSAL.launch.PlayerWindow.java
public PlayerWindow() { setTitle("VASSAL"); setLayout(new BorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ApplicationIcons.setFor(this); // setup menubar and actions final MenuManager mm = MenuManager.getInstance(); final MenuBarProxy mb = mm.getMenuBarProxyFor(this); // file menu//from w w w. j a v a2s . co m final MenuProxy fileMenu = new MenuProxy(Resources.getString("General.file")); fileMenu.setMnemonic(Resources.getString("General.file.shortcut").charAt(0)); fileMenu.add(mm.addMarker("PredefinedSetup.start")); fileMenu.add(mm.addMarker("PredefinedSetup.end")); fileMenu.add(mm.addKey("GameState.new_game")); fileMenu.add(mm.addKey("GameState.load_game")); fileMenu.add(mm.addKey("GameState.save_game")); fileMenu.add(mm.addKey("GameState.close_game")); fileMenu.addSeparator(); fileMenu.add(mm.addKey("BasicLogger.begin_logfile")); fileMenu.add(mm.addKey("BasicLogger.end_logfile")); if (SystemUtils.IS_OS_MAC_OSX) { fileMenu.add(mm.addMarker("Editor.File.start")); fileMenu.add(mm.addMarker("Editor.File.end")); } else { fileMenu.addSeparator(); fileMenu.add(mm.addKey("Prefs.edit_preferences")); fileMenu.addSeparator(); fileMenu.add(mm.addKey("General.quit")); } mm.addAction("General.quit", new ShutDownAction()); // help menu final MenuProxy helpMenu = new MenuProxy(Resources.getString("General.help")); // FIMXE: setting mnemonic from first letter could cause collisions in // some languages helpMenu.setMnemonic(Resources.getString("General.help.shortcut").charAt(0)); helpMenu.add(mm.addMarker("Documentation.VASSAL.start")); helpMenu.add(mm.addKey("General.help")); helpMenu.add(mm.addMarker("Documentation.VASSAL.end")); helpMenu.addSeparator(); helpMenu.add(mm.addMarker("Documentation.Module.start")); helpMenu.add(mm.addMarker("Documentation.Module.end")); helpMenu.add(mm.addKey("Documentation.about_module")); if (!SystemUtils.IS_OS_MAC_OSX) { helpMenu.add(mm.addKey("AboutScreen.about_vassal")); } // Tools menu final MenuProxy toolsMenu = new MenuProxy(Resources.getString("General.tools")); toolsMenu.setMnemonic(Resources.getString("General.tools.shortcut").charAt(0)); toolsMenu.add(mm.addKey("GameRefresher.refresh_counters")); URL url = null; try { url = new File(Documentation.getDocumentationBaseDir(), "README.html").toURI().toURL(); } catch (MalformedURLException e) { ErrorDialog.bug(e); } mm.addAction("General.help", new ShowHelpAction(url, null)); mm.addAction("AboutScreen.about_vassal", new AboutVASSALAction(this)); mb.add(fileMenu); mb.add(toolsMenu); mb.add(mm.addMarker("Editor.MenuBar.start")); mb.add(mm.addMarker("Editor.MenuBar.end")); mb.add(helpMenu); setJMenuBar(mm.getMenuBarFor(this)); // build toolbar toolBar.setLayout(new WrapLayout(FlowLayout.LEFT, 0, 0)); toolBar.setAlignmentX(0.0f); toolBar.setFloatable(false); add(toolBar, BorderLayout.NORTH); // build central area controlPanel.setLayout(new BorderLayout()); controlPanel.setPreferredSize(new Dimension(800, 600)); add(controlPanel, BorderLayout.CENTER); pack(); }
From source file:com.eviware.soapui.impl.rest.panels.mock.RestMockResponseDesktopPanel.java
private JComponent createPanelWithLabel(String labelText, Component rightSideComponent) { JPanel innerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); innerPanel.add(new JLabel(labelText)); innerPanel.add(rightSideComponent);/* ww w. ja v a 2 s .co m*/ return innerPanel; }
From source file:adams.gui.tools.TelnetPanel.java
/** * For initializing the GUI.//ww w . j av a 2 s . c o m */ @Override protected void initGUI() { JPanel topPanel; JPanel bottomPanel; JLabel label; super.initGUI(); setLayout(new BorderLayout()); // connection topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); add(topPanel, BorderLayout.NORTH); m_TextRemote = new BaseTextField(20); label = new JLabel("Remote"); label.setDisplayedMnemonic('R'); label.setLabelFor(m_TextRemote); topPanel.add(label); topPanel.add(m_TextRemote); m_PortModel = new SpinnerNumberModel(); m_PortModel.setMinimum(1); m_PortModel.setMaximum(65536); m_PortModel.setStepSize(1); m_PortModel.setValue(23); m_SpinnerPort = new JSpinner(m_PortModel); label = new JLabel("Port"); label.setDisplayedMnemonic('P'); label.setLabelFor(m_SpinnerPort); topPanel.add(label); topPanel.add(m_SpinnerPort); m_ButtonConnection = new BaseButton(); m_ButtonConnection.setMnemonic('n'); m_ButtonConnection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleConnectionEvent(); } }); topPanel.add(m_ButtonConnection); // output m_ButtonClear = new BaseButton("Clear", GUIHelper.getIcon("new.gif")); m_ButtonClear.setMnemonic('l'); m_ButtonClear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { m_TextOutput.setText(""); } }); m_ButtonCopy = new BaseButton("Copy", GUIHelper.getIcon("copy.gif")); m_ButtonCopy.setMnemonic('C'); m_ButtonCopy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (m_TextOutput.getSelectedText().length() > 0) ClipboardHelper.copyToClipboard(m_TextOutput.getSelectedText()); else if (m_TextOutput.getText().length() > 0) ClipboardHelper.copyToClipboard(m_TextOutput.getText()); } }); m_TextOutput = new BaseTextAreaWithButtons(10, 40); m_TextOutput.setTextFont(Fonts.getMonospacedFont()); m_TextOutput.addToButtonsPanel(m_ButtonClear); m_TextOutput.addToButtonsPanel(m_ButtonCopy); add(m_TextOutput, BorderLayout.CENTER); // commands bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); add(bottomPanel, BorderLayout.SOUTH); m_TextCommand = new BaseTextField(40); m_TextCommand.setFont(Fonts.getMonospacedFont()); m_TextCommand.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_ENTER: e.consume(); execCommand(); break; case KeyEvent.VK_UP: e.consume(); previousCommand(); break; case KeyEvent.VK_DOWN: e.consume(); nextCommand(); break; } } }); label = new JLabel("Command"); label.setDisplayedMnemonic('m'); label.setLabelFor(m_TextCommand); bottomPanel.add(label); bottomPanel.add(m_TextCommand); m_ButtonCommand = new BaseButton(GUIHelper.getIcon("run.gif")); m_ButtonCommand.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { execCommand(); } }); bottomPanel.add(m_ButtonCommand); }
From source file:com.prodigy4440.view.MainJFrame.java
public final void initComponents() { List<Image> icons = new LinkedList<>(); icons.add(new ImageIcon(getClass().getResource("/com/prodigy4440/ited16x16.png")).getImage()); icons.add(new ImageIcon(getClass().getResource("/com/prodigy4440/ited32x32.png")).getImage()); icons.add(new ImageIcon(getClass().getResource("/com/prodigy4440/ited48x48.png")).getImage()); icons.add(new ImageIcon(getClass().getResource("/com/prodigy4440/ited72x72.png")).getImage()); this.setIconImages(icons); ActionHandler actionHandler = new ActionHandler(this); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(620, 520); this.setLocationRelativeTo(null); this.setTitle("Untitled Document- IgboTextEditor"); southJPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); SoftBevelBorder sbb = new SoftBevelBorder(SoftBevelBorder.LOWERED); southJPanel.setBorder(sbb);//from w w w . j a v a2s. c o m menuBar = new JMenuBar(); fileJMenu = new JMenu("File"); fileJMenu.setMnemonic('F'); editJMenu = new JMenu("Edit"); editJMenu.setMnemonic('E'); formatJMenu = new JMenu("Format"); formatJMenu.setMnemonic('A'); viewJMenu = new JMenu("View"); viewJMenu.setMnemonic('V'); helpJMenu = new JMenu("Help"); helpJMenu.setMnemonic('H'); newDocumentJMenuItem = new JMenuItem("New"); newDocumentJMenuItem.addActionListener(actionHandler); newDocumentJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK)); openJMenuItem = new JMenuItem("Open"); openJMenuItem.addActionListener(actionHandler); openJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK)); saveJMenuItem = new JMenuItem("Save"); saveJMenuItem.addActionListener(actionHandler); saveJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); printJMenuItem = new JMenuItem("Print"); printJMenuItem.addActionListener(actionHandler); printJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK)); exitJMenuItem = new JMenuItem("Exit"); exitJMenuItem.addActionListener(actionHandler); undoJMenuItem = new JMenuItem("Undo"); undoJMenuItem.addActionListener(actionHandler); undoJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK)); redoJMenuItem = new JMenuItem("Redo"); redoJMenuItem.addActionListener(actionHandler); redoJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Event.CTRL_MASK)); copyJMenuItem = new JMenuItem("Copy"); copyJMenuItem.addActionListener(actionHandler); copyJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); cutJMenuItem = new JMenuItem("Cut"); cutJMenuItem.addActionListener(actionHandler); cutJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); pasteJMenuItem = new JMenuItem("Paste"); pasteJMenuItem.addActionListener(actionHandler); pasteJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); deleteJMenuItem = new JMenuItem("Delete"); deleteJMenuItem.addActionListener(actionHandler); deleteJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK)); selectAllJMenuItem = new JMenuItem("Select All"); selectAllJMenuItem.addActionListener(actionHandler); selectAllJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK)); findJMenuItem = new JMenuItem("Find"); findJMenuItem.addActionListener(actionHandler); findJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK)); replaceJMenuItem = new JMenuItem("Replace"); replaceJMenuItem.addActionListener(actionHandler); replaceJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.CTRL_MASK)); wordWrapJCheckBoxMenuItem = new JCheckBoxMenuItem("Word Wrap"); wordWrapJCheckBoxMenuItem.addActionListener(actionHandler); wordWrapJCheckBoxMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK)); fontJMenuItem = new JMenuItem("Font"); fontJMenuItem.addActionListener(actionHandler); colorJMenuItem = new JMenuItem("Color"); colorJMenuItem.addActionListener(actionHandler); statusBarJCheckBoxMenuItem = new JCheckBoxMenuItem("Status Bar"); statusBarJCheckBoxMenuItem.addActionListener(actionHandler); statusBarJCheckBoxMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.ALT_MASK)); helpJMenuItem = new JMenuItem("Help"); helpJMenuItem.addActionListener(actionHandler); helpJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.CTRL_MASK)); aboutJMenuItem = new JMenuItem("About"); aboutJMenuItem.addActionListener(actionHandler); statusJLabel = new JLabel("Status:"); //Main text area setup textArea = new JTextArea(); undoManager = new UndoManager(); wordSearcher = new WordSearcher(textArea); textArea.setBorder(BorderFactory.createMatteBorder(4, 4, 4, 4, Color.WHITE)); document = textArea.getDocument(); document.addUndoableEditListener(new UndoableEditListener() { @Override public void undoableEditHappened(UndoableEditEvent e) { undoManager.addEdit(e.getEdit()); } }); font = new Font("Tahoma", Font.PLAIN, 16); textArea.setFont(font); color = Color.BLUE; textArea.setForeground(color); undoManager = new UndoManager(); fileJMenu.add(newDocumentJMenuItem); fileJMenu.addSeparator(); fileJMenu.add(openJMenuItem); fileJMenu.add(saveJMenuItem); fileJMenu.addSeparator(); fileJMenu.add(printJMenuItem); fileJMenu.addSeparator(); fileJMenu.add(exitJMenuItem); editJMenu.add(undoJMenuItem); editJMenu.add(redoJMenuItem); editJMenu.addSeparator(); editJMenu.add(copyJMenuItem); editJMenu.add(cutJMenuItem); editJMenu.add(pasteJMenuItem); editJMenu.addSeparator(); editJMenu.add(deleteJMenuItem); editJMenu.add(selectAllJMenuItem); editJMenu.addSeparator(); editJMenu.add(findJMenuItem); editJMenu.add(replaceJMenuItem); formatJMenu.add(wordWrapJCheckBoxMenuItem); formatJMenu.add(fontJMenuItem); formatJMenu.add(colorJMenuItem); viewJMenu.add(statusBarJCheckBoxMenuItem); helpJMenu.add(helpJMenuItem); helpJMenu.add(aboutJMenuItem); menuBar.add(fileJMenu); menuBar.add(editJMenu); menuBar.add(formatJMenu); menuBar.add(viewJMenu); menuBar.add(helpJMenu); southJPanel.setVisible(false); southJPanel.add(statusJLabel); //JScrollPane setup JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //setting uo the Jframe this.setJMenuBar(menuBar); this.add(scrollPane, BorderLayout.CENTER); this.add(southJPanel, BorderLayout.SOUTH); textArea.addMouseListener(new MouseInputListener() { @Override public void mouseClicked(MouseEvent e) { Highlighter h = textArea.getHighlighter(); h.removeAllHighlights(); } @Override public void mousePressed(MouseEvent e) { Highlighter h = textArea.getHighlighter(); h.removeAllHighlights(); } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseDragged(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { } }); textArea.addKeyListener(new IgboKeyListener(textArea)); }
From source file:fi.elfcloud.client.dialog.ModifyDataItemDialog.java
public ModifyDataItemDialog(JFrame parent, HashMap<String, String> metaMap, String diName) { super(parent, true); setTitle(Messages.getString("ModifyDataItemDialog.window_title") + diName); //$NON-NLS-1$ this.metamap = metaMap; tagVector = new Vector<String>(); setLocationRelativeTo(parent);/* ww w .ja v a 2s . c o m*/ panel.setLayout(new GridBagLayout()); GridBagConstraints cs = new GridBagConstraints(); cs.insets = new Insets(0, 0, 5, 0); lblName = new JLabel(Messages.getString("ModifyDataItemDialog.label_name")); //$NON-NLS-1$ cs.gridx = 0; cs.gridy = 0; cs.fill = GridBagConstraints.HORIZONTAL; cs.gridwidth = 1; cs.weightx = 0; panel.add(lblName, cs); name = new JTextField(getWidth()); cs.gridx = GridBagConstraints.RELATIVE; cs.gridy = 0; cs.fill = GridBagConstraints.HORIZONTAL; cs.gridwidth = 2; cs.weightx = 1.0; name.setText(diName); panel.add(name, cs); lblDescription = new JLabel(Messages.getString("ModifyDataItemDialog.label_description")); //$NON-NLS-1$ cs.gridx = 0; cs.gridy = 1; cs.gridwidth = 1; cs.fill = GridBagConstraints.HORIZONTAL; cs.weightx = 0; panel.add(lblDescription, cs); description = new JTextField(getWidth()); cs.gridx = GridBagConstraints.RELATIVE; cs.gridy = 1; cs.gridwidth = 2; cs.fill = GridBagConstraints.HORIZONTAL; cs.weightx = 1.0; description.setText(metaMap.get("DSC")); //$NON-NLS-1$ panel.add(description, cs); lblTags = new JLabel(Messages.getString("ModifyDataItemDialog.label_tags")); //$NON-NLS-1$ cs.gridx = 0; cs.gridy = 2; cs.gridwidth = 1; cs.fill = GridBagConstraints.HORIZONTAL; cs.weightx = 0; panel.add(lblTags, cs); tags = new JTextField(getWidth()); cs.gridx = GridBagConstraints.RELATIVE; cs.gridy = 2; cs.fill = GridBagConstraints.HORIZONTAL; cs.weightx = 1.0; panel.add(tags, cs); JButton addButton = new JButton(Messages.getString("ModifyDataItemDialog.button_add_tag")); //$NON-NLS-1$ cs.gridx = GridBagConstraints.RELATIVE; cs.gridy = 2; cs.gridwidth = 1; cs.weightx = 0; addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String tagText = tags.getText().trim(); if (!tagText.equals("")) { //$NON-NLS-1$ addTags(tagText); } tags.setText(""); //$NON-NLS-1$ checkboxPanel.revalidate(); checkboxPanel.repaint(); } }); panel.add(addButton, cs); checkboxPanel = new JPanel(new WrapLayout(FlowLayout.LEFT)); checkboxPanel.setSize(new Dimension(320, 1)); try { addTags(metamap.get("TGS")); //$NON-NLS-1$ } catch (NullPointerException e) { // No existing tags } panel.setBorder(new EmptyBorder(5, 5, 0, 5)); getContentPane().add(panel, BorderLayout.NORTH); scrollPane = new JScrollPane(checkboxPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setBorder(null); getContentPane().add(scrollPane, BorderLayout.CENTER); JButton generateButton = new JButton(Messages.getString("ModifyDataItemDialog.button_save")); //$NON-NLS-1$ generateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tags.getText().length() > 0) { addTags(tags.getText()); } answer = true; setVisible(false); } }); JButton cancelButton = new JButton(Messages.getString("ModifyDataItemDialog.button_cancel")); //$NON-NLS-1$ cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { answer = false; setVisible(false); } }); JPanel bp = new JPanel(); bp.add(generateButton); bp.add(cancelButton); getContentPane().add(bp, BorderLayout.PAGE_END); setMinimumSize(new Dimension(320, 350)); pack(); }
From source file:org.shaman.rpg.editor.objects.ui.ElementPropertyVisualPanel1.java
/** * Creates new form ElementPropertyVisualPanel1 *//*from ww w.ja v a 2 s . c om*/ public ElementPropertyVisualPanel1(ElementPropertyWizardPanel1 wizardPanel) { this.wizardPanel = wizardPanel; initComponents(); propertySheet = new PropertySheet(); scene = new GraphSceneImpl(); JScrollPane scenePane = new JScrollPane(scene.createView()); JButton addNew = new JButton( NbBundle.getMessage(ElementPropertyVisualPanel1.class, "ElementPropertyVisualPanel1.addNew")); JButton addExisting = new JButton( NbBundle.getMessage(ElementPropertyVisualPanel1.class, "ElementPropertyVisualPanel1.addExisting")); addNew.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewObjectAction(); } }); addExisting.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addExistingObjectAction(); } }); setLayout(new BorderLayout()); JPanel mainPanel = new JPanel(new GridLayout(1, 2, 5, 5)); mainPanel.add(scenePane); mainPanel.add(propertySheet); JPanel buttonRow = new JPanel(new FlowLayout(FlowLayout.LEFT)); buttonRow.add(addNew); buttonRow.add(addExisting); add(mainPanel, BorderLayout.CENTER); add(buttonRow, BorderLayout.SOUTH); }