public AlignmentPropertyEditor() { super( new int[] { FlowLayout.CENTER, FlowLayout.LEFT, FlowLayout.RIGHT, FlowLayout.LEADING, FlowLayout.TRAILING }, new String[] { "java.awt.FlowLayout.CENTER", // NOI18N "java.awt.FlowLayout.LEFT", // NOI18N "java.awt.FlowLayout.RIGHT", // NOI18N "java.awt.FlowLayout.LEADING", // NOI18N "java.awt.FlowLayout.TRAILING" // NOI18N }, new String[] { "VALUE_AlignmentCenter", // NOI18N "VALUE_AlignmentLeft", // NOI18N "VALUE_AlignmentRight", // NOI18N "VALUE_AlignmentLeading", // NOI18N "VALUE_AlignmentTrailing" // NOI18N } ); }
private void jbInit() throws Exception { //this.setSize(200, 50); this.setFocusable(false); //this.setBackground(); this.setPreferredSize(new Dimension(200, 45)); this.setToolTipText(""); flowLayout1.setHgap(0); flowLayout1.setVgap(0); flowLayout1.setAlignment(FlowLayout.LEFT); this.setLayout(flowLayout1); //this.getContentPane().add(cal, BorderLayout.CENTER); createButtons(); }
public AntFoodsPanel(GUIFacade facade) { this.facade = facade; setLayout(new BorderLayout()); setEvents(); panel_buttons.setLayout(new FlowLayout()); panel_buttons.add(button_set); panel_buttons.add(button_remove); list.setPreferredSize(new Dimension(70, 200)); add(list, BorderLayout.WEST); add(antfoodView, BorderLayout.CENTER); add(panel_buttons, BorderLayout.SOUTH); }
/** * Init panel and helper elements. */ private void init() { this.setLayout(new FlowLayout( FlowLayout.LEADING, 0, 0)); this.add(checkbox); this.add(buttonPanel); this.setMaximumSize( this.getMinimumSize()); checkbox.addItemListener(this); if (checkbox.isSelected()) { buttonPanel.enableButton(); } else { buttonPanel.disableButton(); } }
private void init() { btnTestFileNamePattern = new JButton(); chkFileNameRegex = new JCheckBox(); chkFileNameRegex.setToolTipText(UiUtils.getText( "BasicSearchForm.chkFileNameRegex.tooltip")); //NOI18N if (!replacing) { chkArchives = new JCheckBox(); chkGenerated = new JCheckBox(); } chkUseIgnoreList = new JCheckBox(); btnEditIgnoreList = new JButton(); checkBoxListener = new CheckBoxListener(); component.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); setMnemonics(); initIgnoreListControlComponents(); initScopeOptionsRow(replacing); initInteraction(); }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setLayout(new FlowLayout()); frame.setVisible(true); JButton button1 = new JButton("点我!"); JButton button2 = new JButton("也点我!"); frame.getContentPane().add(button1); frame.getContentPane().add(button2); //这里addActionListener方法的参数是ActionListener,是一个函数式接口 //使用lambda表达式方式 button1.addActionListener(e -> { System.out.println("这里是Lambda实现方式"); }); //使用方法引用方式 button2.addActionListener(TestMethodReference::doSomething); }
private void initComponents() { setLayout(new BorderLayout()); previewPanel = new JPanel(new FlowLayout(0, 0, FlowLayout.LEADING)); previewPanel.setBorder(BorderFactory.createEmptyBorder(4, 7, 2, 7)); label = new JLabel(); label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 7, 7, 7), new ThinBevelBorder(BevelBorder.LOWERED))); label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), BorderFactory.createEmptyBorder(4, 3, 4, 3))); label.setFont(label.getFont().deriveFont(Font.BOLD)); JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createRaisedBevelBorder()); p.add(previewPanel, BorderLayout.NORTH); p.add(label, BorderLayout.CENTER); add(p, BorderLayout.CENTER); }
protected JPanel makeButtonPanel(AbstractButton... buttons) { JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP, GAP)); for (final AbstractButton button : buttons) { if (button != null) { buttonPanel.add(button); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_DIALOG, key, button.getActionCommand()); } }); } } return buttonPanel; }
@Override public void init() { tf = new TextField(20); tf.setText("0123456789"); tf.select(0, 6); final TextArea ta = new TextArea("INSTRUCTIONS:\n" + "The text 012345 should be selected in the TextField.\n" + "If this is what you observe, then the test passes.\n" + "Otherwise, the test fails.", 40, 5, TextArea.SCROLLBARS_NONE); ta.setEditable(false); ta.setPreferredSize(new Dimension(300, 70)); final Panel panel = new Panel(); panel.setLayout(new FlowLayout()); panel.add(tf); setLayout(new BorderLayout()); add(ta, BorderLayout.CENTER); add(panel, BorderLayout.PAGE_END); }
public ActionEventTest() { try { robot = new Robot(); robot.setAutoDelay(100); robot.setAutoWaitForIdle(true); } catch(AWTException e) { throw new RuntimeException(e.getMessage()); } list = new List(1, false); list.add("0"); add(list); setSize(400,400); setLayout(new FlowLayout()); pack(); setVisible(true); }
/** * Create the dialog. */ public Main_AllRooms() { bean = LocaleBean.getInstance(); componentOrientation = new ChangeComponentOrientation(); componentOrientation.setThePanel(contentPanel); systemStatus = systemStatusImpl.getSystemStatus(); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setBackground(Color.decode("#066d95")); contentPanel.setPreferredSize(new Dimension(700, 1000)); contentPanel.setLayout(new FlowLayout()); cookRooms(contentPanel); //change component orientation with locale. if (bean.getLocale().toString().equals("ar_IQ")) { componentOrientation.changeOrientationOfJPanelToRight(); } else { componentOrientation.changeOrientationOfJPanelToLeft(); } contentPanel.setVisible(true); }
public ItemEventTest() { try { robot = new Robot(); } catch(AWTException e) { throw new RuntimeException(e.getMessage()); } expectedSelectionOrder = "01230123"; list = new List(4, true); list.add("0"); list.add("1"); list.add("2"); list.add("3"); add(list); setSize(400,400); setLayout(new FlowLayout()); pack(); setVisible(true); robot.waitForIdle(); }
public TableInfoWindow() { newTableName = new JTextField(); cancelButton = new JButton(" ✘ Cancel "); nextButton = new JButton(" ✔ Next "); setLayout(new BorderLayout()); JPanel tableNamePanel = new JPanel(); tableNamePanel.add(new JLabel("Table name: ")); tableNamePanel.add(newTableName); JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonsPanel.add(cancelButton); buttonsPanel.add(nextButton); add(tableNamePanel, BorderLayout.CENTER); add(buttonsPanel, BorderLayout.SOUTH); buildWindow(); pack(); }
@BeforeMethod public void showDialog() throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { frame = new JFrame("My Dialog"); frame.setName("dialog-1"); JSpinner listSpinner = createListSpinner(); Calendar calendar = Calendar.getInstance(); JSpinner numberSpinner = createNumberSpinner(calendar); JSpinner dateSpinner = createDateSpinner(calendar); frame.setLayout(new FlowLayout()); frame.getContentPane().add(listSpinner); frame.getContentPane().add(numberSpinner); frame.getContentPane().add(dateSpinner); frame.pack(); frame.setAlwaysOnTop(true); frame.setVisible(true); } }); driver = new JavaAgent(); }
private static void setup(final Point tmp) { comboBox = new JComboBox<>(); for (int i = 1; i < 7; i++) { comboBox.addItem("Long-long-long-long-long text in the item-" + i); } String property = System.getProperty(PROPERTY_NAME); comboBox.putClientProperty(PROPERTY_NAME, Boolean.valueOf(property)); frame = new JFrame(); frame.setAlwaysOnTop(true); frame.setLayout(new FlowLayout()); frame.add(comboBox); frame.pack(); frame.setSize(frame.getWidth(), SIZE); frame.setVisible(true); frame.setLocation(tmp.x, tmp.y); }
private void initComponents() { mixPane = new WarningScrollTable(mixTable, WARNING_CLASS); mixPane.setBorder(new TitledBorder(new EtchedBorder(), "Join Options")); noOptLabelPanel.setBorder(new TitledBorder(new EtchedBorder(), "Join Options")); noOptLabel.setOpaque(false); noOptLabel.setEditable(false); noOptLabel.setLineWrap(true); noOptLabel.setWrapStyleWord(true); descrTextPane.setOpaque(false); descrTextPane.setEditable(false); descrTextPane.setLineWrap(true); descrTextPane.setWrapStyleWord(true); descrPane.setBorder(new TitledBorder(new EtchedBorder(), "Description")); descrPane.setViewportView(descrTextPane); joinPane.setLayout(new FlowLayout()); JLabel text = new JLabel("Number of Required Tasks:"); jNumField.setPreferredSize(DIM_BUTTON_XS); joinPane.add(text); joinPane.add(jNumField); joinPane.setBorder(new TitledBorder(new EtchedBorder(), "Join Options")); setLeftComponent(descrPane); }
public static void main(String[] args) { // Some basic tests JFrame frame = new JFrame(); frame.getContentPane().setLayout(new FlowLayout()); JButton button; addButton(frame, "&File"); addButton(frame, "S&ave As..."); addButton(frame, "Save &As..."); addButton(frame, "Fo&o"); addButton(frame, "Foo"); // Error cases - make sure we handle them sensibly addButton(frame, ""); addButton(frame, "&"); addButton(frame, "Foo&"); addButton(frame, "Cat & Dog"); addButton(frame, "Cat && Dog"); frame.pack(); frame.show(); }
public void actionPerformed (ActionEvent evt) { centerPanel = new JPanel(new FlowLayout()); iterationsLabel = new JLabel("Iterations"); iterationsField = new JTextField((new Integer(VRProblemModel.DEFAULT_LSD_ITERATIONS)).toString(), 4); lambdaLabel = new JLabel("Lambda size"); lambdaField = new JTextField((new Integer(VRProblemModel.DEFAULT_LAMBDA)).toString(), 4); globalBestSearchBox = new JCheckBox("Global Best Search"); badMovesBox = new JCheckBox("Accept Bad Moves"); centerPanel.add(iterationsLabel); centerPanel.add(iterationsField); centerPanel.add(lambdaLabel); centerPanel.add(lambdaField); centerPanel.add(globalBestSearchBox); centerPanel.add(badMovesBox); // Add demands table in Center Panel centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); centerPanel.setBackground(Color.getColor("202,198,202")); // Add panels in Main Panel getContentPane().add(centerPanel,BorderLayout.CENTER); }
public ScoreboardSmall(final CreateGameData cgd) { setLayout(new FlowLayout()); setPreferredSize(new Dimension(250, 30)); if (cgd.getTeams() != null) { createTurnsArea(); this.labels = new JLabel[cgd.getTeams().length]; this.texts = new JTextField[cgd.getTeams().length]; int i = 0; for (final String it : cgd.getTeams()) { this.labels[i] = new JLabel(it); this.labels[i].setFont(new Font(SCORE_FONT, Font.BOLD, SCORE_FONT_SIZE)); this.labels[i].setBorder(BorderFactory.createLineBorder(colors.get(i % colors.size()), 1)); this.texts[i] = new JTextField(); this.texts[i].setColumns(5); this.texts[i].setEditable(false); add(this.labels[i]); add(this.texts[i]); i++; } } }
public void actionPerformed (ActionEvent evt) { centerPanel = new JPanel(new FlowLayout()); aStarExecutionMeasureBox = new JCheckBox("AStar Execution Measure", TSProblemModel.ASTAR_DEFAULT_MEASURE_EXECUTION); gaExecutionMeasureBox = new JCheckBox("GA Execution Measure", TSProblemModel.GA_DEFAULT_MEASURE_EXECUTION); pfihExecutionMeasureBox = new JCheckBox("PFIH Execution Measure", VRProblemModel.PFIH_DEFAULT_MEASURE_EXECUTION); lsdExecutionMeasureBox = new JCheckBox("Local Search Execution Measure", VRProblemModel.LSD_DEFAULT_MEASURE_EXECUTION); saExecutionMeasureBox = new JCheckBox("SA Execution Measure", VRProblemModel.SA_DEFAULT_MEASURE_EXECUTION); centerPanel.add(aStarExecutionMeasureBox); centerPanel.add(gaExecutionMeasureBox); centerPanel.add(pfihExecutionMeasureBox); centerPanel.add(lsdExecutionMeasureBox); centerPanel.add(saExecutionMeasureBox); // Add demands table in Center Panel centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); centerPanel.setBackground(Color.getColor("202,198,202")); // Add panels in Main Panel getContentPane().add(centerPanel,BorderLayout.CENTER); }
void jbInit() throws Exception { border1 = BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder( Color.white, new Color(156, 156, 158)), BorderFactory.createEmptyBorder(5, 5, 5, 5)); border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0); panel1.setLayout(borderLayout1); this.getContentPane().setLayout(borderLayout2); bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); topPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5))); topPanel.setBackground(Color.WHITE); jPanel1.setLayout(borderLayout3); panel1.setBorder(border1); jPanel1.setBorder(border2); getContentPane().add(panel1, BorderLayout.CENTER); panel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(stickerText, null); panel1.add(jPanel1, BorderLayout.SOUTH); this.getContentPane().add(bottomPanel, BorderLayout.SOUTH); this.getContentPane().add(topPanel, BorderLayout.NORTH); stickerText.setText(txt); stickerText.setOpaque(true); stickerText.setBackground(backGroundColor); stickerText.setForeground(foreGroundColor); }
/** * Initialize print dialog. */ void initPrintDialog(int x, int y, PrintService[] services, int defaultServiceIndex, DocFlavor flavor, PrintRequestAttributeSet attributes) { this.services = services; this.defaultServiceIndex = defaultServiceIndex; this.asOriginal = attributes; this.asCurrent = new HashPrintRequestAttributeSet(attributes); this.psCurrent = services[defaultServiceIndex]; this.docFlavor = flavor; SunPageSelection pages = (SunPageSelection)attributes.get(SunPageSelection.class); if (pages != null) { isAWT = true; } if (attributes.get(DialogOnTop.class) != null) { setAlwaysOnTop(true); } Container c = getContentPane(); c.setLayout(new BorderLayout()); tpTabs = new JTabbedPane(); tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5)); String gkey = getMsg("tab.general"); int gmnemonic = getVKMnemonic("tab.general"); pnlGeneral = new GeneralPanel(); tpTabs.add(gkey, pnlGeneral); tpTabs.setMnemonicAt(0, gmnemonic); String pkey = getMsg("tab.pagesetup"); int pmnemonic = getVKMnemonic("tab.pagesetup"); pnlPageSetup = new PageSetupPanel(); tpTabs.add(pkey, pnlPageSetup); tpTabs.setMnemonicAt(1, pmnemonic); String akey = getMsg("tab.appearance"); int amnemonic = getVKMnemonic("tab.appearance"); pnlAppearance = new AppearancePanel(); tpTabs.add(akey, pnlAppearance); tpTabs.setMnemonicAt(2, amnemonic); c.add(tpTabs, BorderLayout.CENTER); updatePanels(); JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING)); btnApprove = createExitButton("button.print", this); pnlSouth.add(btnApprove); getRootPane().setDefaultButton(btnApprove); btnCancel = createExitButton("button.cancel", this); handleEscKey(btnCancel); pnlSouth.add(btnCancel); c.add(pnlSouth, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dispose(CANCEL); } }); getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle")); setResizable(false); setLocation(x, y); pack(); }
CardPanel(ActionListener actionListener) { listener = actionListener; setLayout(new CardLayout()); add("one", create(new FlowLayout())); add("two", create(new BorderLayout())); add("three", create(new GridLayout(2, 2))); add("four", create(new BorderLayout(10, 10))); add("five", create(new FlowLayout(FlowLayout.LEFT, 10, 10))); add("six", create(new GridLayout(2, 2, 10, 10))); }
public StartupProgressDialog(ZCashClientCaller clientCaller) { this.clientCaller = clientCaller; URL iconUrl = this.getClass().getClassLoader().getResource("images/ZEN-yellow.orange-logo.png"); imageIcon = new ImageIcon(iconUrl); imageLabel.setIcon(imageIcon); imageLabel.setBorder(BorderFactory.createEmptyBorder(16, 16, 0, 16)); Container contentPane = getContentPane(); contentPane.setLayout(borderLayout1); southPanel.setLayout(southPanelLayout); southPanel.setBorder(BorderFactory.createEmptyBorder(0, 16, 16, 16)); contentPane.add(imageLabel, BorderLayout.NORTH); JLabel zcashWalletLabel = new JLabel( "<html><span style=\"font-style:italic;font-weight:bold;font-size:2.2em\">" + "ZENCash Wallet</span></html>"); zcashWalletLabel.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16)); // todo - place in a panel with flow center JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 1)); tempPanel.add(zcashWalletLabel); contentPane.add(tempPanel, BorderLayout.CENTER); contentPane.add(southPanel, BorderLayout.SOUTH); progressBar.setIndeterminate(true); southPanel.add(progressBar, BorderLayout.NORTH); progressLabel.setText("Starting..."); southPanel.add(progressLabel, BorderLayout.SOUTH); pack(); setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); }
public static void main( String[] args ) { JFrame frame = new JFrame( "Simple Graph View" ); frame.setLayout( new FlowLayout() ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.getContentPane().add( new ManualPanel() ); frame.pack(); frame.setVisible( true ); }
/** * Initialize panel for controls for scope options and add it to the form * panel. */ private void initScopeOptionsRow(boolean searchAndReplace) { JPanel regexpPanel = new CheckBoxWithButtonPanel( chkFileNameRegex, btnTestFileNamePattern); if (fileNameComponent != null) { fileNameComponent.setLayout( new FlowLayout(FlowLayout.LEADING, 0, 0)); fileNameComponent.add(ignoreListOptionPanel); fileNameComponent.add(regexpPanel); if (!searchAndReplace) { component.add(chkArchives); component.add(chkGenerated); } } else { JPanel jp = new JPanel(); if (searchAndReplace) { jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); jp.add(ignoreListOptionPanel); jp.add(regexpPanel); jp.setMaximumSize(jp.getMinimumSize()); } else { FormLayoutHelper flh = new FormLayoutHelper(jp, FormLayoutHelper.DEFAULT_COLUMN, FormLayoutHelper.DEFAULT_COLUMN); flh.addRow(chkArchives, chkGenerated); flh.addRow(ignoreListOptionPanel, new CheckBoxWithButtonPanel( chkFileNameRegex, btnTestFileNamePattern)); jp.setMaximumSize(jp.getMinimumSize()); } component.add(jp); } }
public static void main(String[] args) throws Exception { Frame frame = new Frame(); frame.setSize(300, 200); TextField textField = new TextField(TEXT + LAST_WORD, 30); Panel panel = new Panel(new FlowLayout()); panel.add(textField); frame.add(panel); frame.setVisible(true); Robot robot = new Robot(); robot.setAutoDelay(50); robot.waitForIdle(); Point point = textField.getLocationOnScreen(); int x = point.x + textField.getWidth() / 2; int y = point.y + textField.getHeight() / 2; robot.mouseMove(x, y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.waitForIdle(); robot.mousePress(InputEvent.BUTTON1_MASK); int N = 10; int dx = textField.getWidth() / N; for (int i = 0; i < N; i++) { x += dx; robot.mouseMove(x, y); } robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.waitForIdle(); if (!textField.getSelectedText().endsWith(LAST_WORD)) { throw new RuntimeException("Last word is not selected!"); } }
/** * Initialize "page setup" dialog */ void initPageDialog(int x, int y, PrintService ps, DocFlavor flavor, PrintRequestAttributeSet attributes) { this.psCurrent = ps; this.docFlavor = flavor; this.asOriginal = attributes; this.asCurrent = new HashPrintRequestAttributeSet(attributes); Container c = getContentPane(); c.setLayout(new BorderLayout()); pnlPageSetup = new PageSetupPanel(); c.add(pnlPageSetup, BorderLayout.CENTER); pnlPageSetup.updateInfo(); JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING)); btnApprove = createExitButton("button.ok", this); pnlSouth.add(btnApprove); getRootPane().setDefaultButton(btnApprove); btnCancel = createExitButton("button.cancel", this); handleEscKey(btnCancel); pnlSouth.add(btnCancel); c.add(pnlSouth, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dispose(CANCEL); } }); getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle")); setResizable(false); setLocation(x, y); pack(); }
public JATextInput(Component c, String title, String borderText) { setPreferredSize(new Dimension(100, 300)); panelControl.setLayout(new FlowLayout()); setLayout(new BorderLayout()); setLocationRelativeTo(c); setTitle(title); ta.setBorder(new TitledBorder(new EtchedBorder(), borderText)); add(sp, BorderLayout.CENTER); }
@Override protected void setUp() throws Exception { PropUtils.forceRadioButtons=false; jf = new JFrame(); jf.getContentPane().setLayout(new FlowLayout()); jf.setSize (400,400); jf.setLocation (30,30); jf.show(); }
private JPanel createButtonArea() { JButton childButton = new JButton(addChildAction); JButton siblingButton = new JButton(addSiblingAction); JButton removeButton = new JButton(removeAction); JPanel all = new JPanel(new FlowLayout()); all.add(childButton); all.add(siblingButton); all.add(removeButton); all.setPreferredSize(all.getMinimumSize()); return all; }
public StatusLineComponent() { handleComponentMap = new HashMap<InternalHandle, ListComponent>(); FlowLayout flay = new FlowLayout(); flay.setVgap(1); flay.setHgap(5); setLayout(flay); mouseListener = new MListener(); addMouseListener(mouseListener); hideListener = new HideAWTListener(); createLabel(); createBar(); // tricks to figure out correct height. bar.setStringPainted(true); bar.setString("@@@"); // NOI18N label.setText("@@@"); // NOI18N preferredHeight = Math.max(label.getPreferredSize().height, bar.getPreferredSize().height) + 3; setOpaque(false); discardLabel(); discardBar(); pane = new PopupPane(); pane.getActionMap().put("HidePopup", new AbstractAction() { public @Override void actionPerformed(ActionEvent actionEvent) { // System.out.println("escape pressed - hiding"); hidePopup(); } }); pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup"); pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup"); }
@Override @SuppressWarnings("deprecation") public void init(Component parent) { config = new VersionSelectionConfig(true); setLayout(new FlowLayout(FlowLayout.LEFT)); add(config); }
private void init() { setLayout(new FlowLayout()); valueField.addActionListener(this); setInvalidValueButton.addActionListener(this); setDontAllowValidateButton.addActionListener(this); valueField.setColumns(30); setBackground(Color.ORANGE); add (valueField); add (setInvalidValueButton); add (setDontAllowValidateButton); }
protected void setUp() throws Exception { PropUtils.forceRadioButtons=false; jf = new JFrame(); jf.getContentPane().setLayout(new FlowLayout()); jf.setSize (400,400); jf.setLocation (30,30); jf.show(); }
public ActionEventTest() { try { robot = new Robot(); } catch(AWTException e) { throw new RuntimeException(e.getMessage()); } button = new Button("ClickMe"); button.setEnabled(true); instructions = new TextArea(10, 50); instructions.setText( " This is a manual test\n" + " Keep the Alt, Shift & Ctrl Keys pressed &\n" + " Click 'ClickMe' button with left mouse button\n" + " Test exits automatically after mouse click."); add(button); add(instructions); setSize(400,400); setLayout(new FlowLayout()); pack(); setVisible(true); robot.waitForIdle(); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int md = ae.getModifiers(); int expectedMask = ActionEvent.ALT_MASK | ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK; isProgInterruption = true; mainThread.interrupt(); if ((md & expectedMask) != expectedMask) { throw new RuntimeException("Action Event modifiers" + " are not set correctly."); } } }); }
public EventRenderer () { pathLabel = new JLabel(); actionLabel = new JLabel(); actionButton = new LinkButton("..."); //NOI18N actionButton.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); FlowLayout l = new FlowLayout(FlowLayout.LEFT, 0, 0); l.setAlignOnBaseline(true); setLayout(l); add(actionLabel); actionLabel.setBorder(BorderFactory.createEmptyBorder(0, INDENT, 0, 10)); add(pathLabel); add(actionButton); }
public void start() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); comboBox = new JComboBox<String>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }); contentPane.setLayout(new FlowLayout()); contentPane.add(comboBox); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); }