Java Code Examples for javax.swing.JPanel
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.
Source file: AuxComponentFactory.java

public static JComponent createUnscrollableTablePanel(JTable table){ JPanel panel=new JPanel(new BorderLayout()); panel.add(table,BorderLayout.CENTER); panel.add(table.getTableHeader(),BorderLayout.PAGE_START); table.setBackground(Color.WHITE); table.setBorder(BorderFactory.createLineBorder(Color.GRAY,1)); return panel; }
Example 2
From project Agot-Java, under directory /src/main/java/got/ui/.
Source file: FamilyCharacterDialog.java

private JComponent familyCharacter(String charName){ JPanel panel=new JPanel(false); panel.setLayout(new GridLayout(1,2)); JLabel nameLabel=new JLabel(charName); panel.add(nameLabel); CharacterInfo characterInfo=node.getGameInfo().getCharacterMap().get(charName); String des=String.format("<html><B>Power</B> : %d <br><br> <B>Sword</B> : %d <br><br> <B>Sheild</B> : %d <br><br> <B>Speical</B> : %s <br><br></html>",characterInfo.getPower(),characterInfo.getSword(),characterInfo.getShield(),characterInfo.getSpecial()); JLabel desLabel=new JLabel(des); panel.add(desLabel); return panel; }
Example 3
JPanel initFirstRow(){ JPanel first=new JPanel(); first.setLayout(new FlowLayout()); I=new InputField(5,M.statusBar,D.M.S); first.add(I); actionButtons(first); initPrevious(); initNext(); first.add(previous); first.add(next); actionButtons2(first); return first; }
Example 4
From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.
Source file: IcolForm.java

private JPanel createAdvancedOptionsPanel(){ TableLayout layout=new TableLayout(2); layout.setTableAnchor(TableLayout.Anchor.WEST); layout.setTableFill(TableLayout.Fill.HORIZONTAL); layout.setColumnWeightX(0,1); layout.setColumnWeightX(1,0.1); layout.setTablePadding(2,2); layout.setCellColspan(0,0,2); layout.setCellColspan(1,0,2); JPanel panel=new JPanel(layout); panel.setBorder(BorderFactory.createTitledBorder("Advanced Options")); return panel; }
Example 5
From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/.
Source file: MillView.java

/** * -------------------------------------- Instance Initialization -------------------------------------- * @param logActiveStateView DOCUMENT ME! * @param logStatus DOCUMENT ME! * @param tableStatus DOCUMENT ME! * @param eventsPanel DOCUMENT ME! * @param filterSetView DOCUMENT ME! */ public MillView(final LogActiveStateView logActiveStateView,final LogStatus logStatus,final TableStatus tableStatus,final EventsPanel eventsPanel,final FilterSetView filterSetView){ final JSplitPane treeEventsSplit; final JPanel logStateStatusPanel; logStateStatusPanel=new JPanel(); logStateStatusPanel.add(logActiveStateView); logStateStatusPanel.add(logStatus); logStateStatusPanel.add(tableStatus); treeEventsSplit=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,filterSetView,eventsPanel); setLayout(new BorderLayout()); add(BorderLayout.NORTH,logStateStatusPanel); add(BorderLayout.CENTER,treeEventsSplit); }
Example 6
From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/demo/.
Source file: DemoView.java

private static JPanel panelOf(JComponent... comps){ JPanel p=new JPanel(); p.setOpaque(false); for ( JComponent comp : comps) { p.add(comp); } return p; }
Example 7
From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/result/.
Source file: TreatmentStepGui.java

private void buildGui(){ mainPanel=new JPanel(); mainPanel.putClientProperty(ResultTreatmentGui.RESULT_TRT_GUI_PROP,this); mainPanel.setLayout(cardLayout); mainPanel.setBackground(Color.lightGray); editorPane.setContentType("text/html"); editorPane.setEditable(false); JPanel htmlPanel=new JPanel(new BorderLayout()); htmlPanel.add(new JScrollPane(editorPane),BorderLayout.CENTER); mainPanel.add(tableResultPanel,"MODE0"); mainPanel.add(htmlPanel,"MODE1"); }
Example 8
From project codjo-segmentation, under directory /codjo-segmentation-gui/src/test/java/net/codjo/segmentation/gui/settings/.
Source file: ClassificationStructureGuiTest.java

public void test_setClassificationExtensionPanel() throws Exception { ClassificationStructureGui structureGui=new ClassificationStructureGui("toto"); JPanel jPanel=new JPanel(); JTextField field=new JTextField(10); field.setText("My text"); field.setName("toto2"); jPanel.add(field); structureGui.setClassificationExtensionPanel(jPanel); Window window=new Window(structureGui); TextBox textBox=window.getTextBox("toto2"); assertEquals("My text",textBox.getText()); }
Example 9
From project collaborative-editor, under directory /mpedit/gui/.
Source file: CDialogTemplate.java

protected void init(){ getContentPane().setLayout(new BorderLayout()); this.setResizable(false); JPanel panel_buttons=this.drawButtonPanel(); getContentPane().add(panel_buttons,BorderLayout.SOUTH); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLocation((int)(Toolkit.getDefaultToolkit().getScreenSize().width / 4),(int)(Toolkit.getDefaultToolkit().getScreenSize().height / 4)); }
Example 10
From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.
Source file: DefaultMetaDataView.java

private JPanel createNamedDatatypeInfoPanel(Datatype t){ JPanel panel=new JPanel(); panel.setLayout(new BorderLayout()); JTextArea infoArea=new JTextArea(t.getDatatypeDescription()); infoArea.setEditable(false); panel.add(infoArea,BorderLayout.CENTER); return panel; }
Example 11
From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.
Source file: LogBrokerMonitor.java

protected JPanel createStatusArea(){ JPanel statusArea=new JPanel(); JLabel status=new JLabel("No log records to display."); _statusLabel=status; status.setHorizontalAlignment(JLabel.LEFT); statusArea.setBorder(BorderFactory.createEtchedBorder()); statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0)); statusArea.add(status); return (statusArea); }
Example 12
From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/app/.
Source file: DroolsPlannerExamplesApp.java

private Container createContentPane(){ JPanel contentPane=new JPanel(new BorderLayout(10,10)); contentPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); JLabel titleLabel=new JLabel("Which example do you want to see?",JLabel.CENTER); titleLabel.setFont(titleLabel.getFont().deriveFont(20.0f)); contentPane.add(titleLabel,BorderLayout.NORTH); JScrollPane examplesScrollPane=new JScrollPane(createExamplesPanel()); examplesScrollPane.getHorizontalScrollBar().setUnitIncrement(20); examplesScrollPane.getVerticalScrollBar().setUnitIncrement(20); contentPane.add(examplesScrollPane,BorderLayout.CENTER); contentPane.add(createDescriptionPanel(),BorderLayout.SOUTH); return contentPane; }
Example 13
From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/filesearch/.
Source file: FileSearchPanel.java

/** * This method is called from within the constructor to initialize the form. */ private void customizeComponents(){ this.setLayout(new BorderLayout()); JPanel filterPanel=new JPanel(); filterPanel.setLayout(new BoxLayout(filterPanel,BoxLayout.Y_AXIS)); filterPanel.setBorder(new EmptyBorder(10,10,10,10)); this.add(filterPanel,BorderLayout.CENTER); JLabel label=new JLabel("Search for files that match the following criteria:"); label.setAlignmentX(Component.LEFT_ALIGNMENT); label.setBorder(new EmptyBorder(0,0,10,0)); filterPanel.add(label); this.filterAreas.add(new FilterArea("Name",new NameSearchFilter())); List<FileSearchFilter> metadataFilters=new ArrayList<FileSearchFilter>(); metadataFilters.add(new SizeSearchFilter()); metadataFilters.add(new DateSearchFilter()); this.filterAreas.add(new FilterArea("Metadata",metadataFilters)); this.filterAreas.add(new FilterArea("Known Status",new KnownStatusSearchFilter())); for ( FilterArea fa : this.filterAreas) { fa.setMaximumSize(new Dimension(Integer.MAX_VALUE,fa.getMinimumSize().height)); fa.setAlignmentX(Component.LEFT_ALIGNMENT); filterPanel.add(fa); } this.searchButton=new JButton("Search"); this.searchButton.setAlignmentX(Component.LEFT_ALIGNMENT); filterPanel.add(searchButton); addListenerToAll(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ search(); } } ); }
Example 14
From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/ui/.
Source file: BaerUi.java

/** * Creates all user interface components and sets them to their appropriate default values */ private void createUI(){ int line=0; JPanel ioParamPanel=GridBagUtils.createDefaultEmptyBorderPanel(); GridBagConstraints gbc=GridBagUtils.createConstraints(null); addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.INPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=2; addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.OUTPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=10; final JLabel outFormatLabel=new JLabel(OUT_FORMAT_LABEL); _fileFormatCombo=new JComboBox(_fileFormatNames); _fileFormatCombo.addActionListener(new ActionListener(){ public void actionPerformed( final ActionEvent e){ updateOutFileType(); } } ); GridBagUtils.setAttributes(gbc,"anchor=SOUTHWEST, fill=NONE, insets.top=12, weightx = 0, weighty=0.5, gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(ioParamPanel,outFormatLabel,gbc); GridBagUtils.setAttributes(gbc,"anchor=NORTHWEST, weighty=0.5, insets.top=0 ,gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(ioParamPanel,_fileFormatCombo,gbc); JPanel procParamPanel=GridBagUtils.createDefaultEmptyBorderPanel(); gbc=GridBagUtils.createConstraints(null); addParameterToPanel2(procParamPanel,BaerConstants.USE_CLOUD_PARAM_NAME,line++,12,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.USE_BAER_PARAM_NAME,line++,2,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.USE_ATM_COR_PARAM_NAME,line++,2,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.SMAC_PARAM_NAME,line++,12,true,gbc); addParameterToPanel2(procParamPanel,BaerConstants.AER_PHASE_PARAM_NAME,line++,2,true,gbc); addParameterToPanel2(procParamPanel,BaerConstants.BITMASK_PARAM_NAME,line++,12,false,gbc); getParameter(BaerConstants.USE_CLOUD_PARAM_NAME).getEditor().setEnabled(false); final JTabbedPane tabbedPane=new JTabbedPane(); tabbedPane.addTab("I/O Parameters",ioParamPanel); tabbedPane.addTab("Processing Parameters",procParamPanel); _uiComponent=tabbedPane; }
Example 15
public FilePanel(Wallet w){ super(w); this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); this.add(createHeaderPanel("file_small.png","File"),BorderLayout.NORTH); SubPanel subPanel=new SubPanel(); subPanel.setLayout(new CardLayout()); subPanel.setBorder(BorderFactory.createMatteBorder(1,0,0,0,Color.DARK_GRAY)); SubPanel newWalletPanel=new SubPanel("Create a New Wallet"); subPanel.add("New Wallet",newWalletPanel); SubPanel editWalletPanel=new SubPanel("Edit a Wallet"); subPanel.add("Edit Wallet",editWalletPanel); SubPanel loadWalletPanel=new SubPanel("Load a Wallet"); subPanel.add("Load Wallet",loadWalletPanel); SubPanel saveWalletPanel=new SubPanel("Save a Wallet"); subPanel.add("Save Wallet",saveWalletPanel); JPanel sidePanel=createSidePanel(this,subPanel,"Header","New Wallet","Edit Wallet","Load Wallet","Save Wallet"); this.add(sidePanel,BorderLayout.WEST); this.add(subPanel); currentSubPanel=newWalletPanel; }
Example 16
private void showAbout(){ JEditorPane htmlPane=new JEditorPane("text/html","<html>\n" + " <body>\n" + "<p><b>BoneJ version " + bonejVersion + "</b> </p>"+ "<p>BoneJ is an ImageJ plugin designed for (but not limited to) bone image analysis.</p>"+ "<p>User and developer documentation can be found at <a href=http://bonej.org/>bonej.org</a></p>"+ "\n"+ " </body>\n"+ "</html>"); htmlPane.setEditable(false); htmlPane.setOpaque(false); htmlPane.addHyperlinkListener(new HyperlinkListener(){ public void hyperlinkUpdate( HyperlinkEvent e){ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) try { BrowserLauncher.openURL(e.getURL().toString()); } catch ( IOException exception) { } } } ); JPanel panel=new JPanel(new BorderLayout()); panel.add(htmlPane,BorderLayout.CENTER); final JFrame frame=new JFrame("About BoneJ..."); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(panel,BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
Example 17
From project Calendar-Application, under directory /com/toedter/calendar/demo/.
Source file: DateChooserPanel.java

private void addEntry(String text,JComponent component,GridBagLayout grid){ JLabel label=new JLabel(text + ": ",null,JLabel.RIGHT); GridBagConstraints c=new GridBagConstraints(); c.weightx=1.0; c.fill=GridBagConstraints.BOTH; grid.setConstraints(label,c); add(label); c.gridwidth=GridBagConstraints.REMAINDER; grid.setConstraints(component,c); add(component); JPanel blankLine=new JPanel(){ private static final long serialVersionUID=4514530330521503732L; public Dimension getPreferredSize(){ return new Dimension(10,3); } } ; grid.setConstraints(blankLine,c); add(blankLine); }
Example 18
From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/binding/internal/.
Source file: FileEditor.java

@Override public JComponent createEditorComponent(PropertyDescriptor propertyDescriptor,BindingContext bindingContext){ final JTextField textField=new JTextField(); final ComponentAdapter adapter=new TextComponentAdapter(textField); final Binding binding=bindingContext.bind(propertyDescriptor.getName(),adapter); final JPanel editorPanel=new JPanel(new BorderLayout(2,2)); editorPanel.add(textField,BorderLayout.CENTER); final JButton etcButton=new JButton("..."); final Dimension size=new Dimension(26,16); etcButton.setPreferredSize(size); etcButton.setMinimumSize(size); etcButton.addActionListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ final JFileChooser fileChooser=new JFileChooser(); int i=fileChooser.showDialog(editorPanel,"Select"); if (i == JFileChooser.APPROVE_OPTION && fileChooser.getSelectedFile() != null) { binding.setPropertyValue(fileChooser.getSelectedFile()); } } } ); editorPanel.add(etcButton,BorderLayout.EAST); return editorPanel; }
Example 19
From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/.
Source file: Gui.java

public Gui(Main main){ super("ChkBugReport - (C) 2012 Sony-Ericsson"); mMain=main; JTabbedPane tabs=new JTabbedPane(); setContentPane(tabs); JPanel runPanel=new JPanel(new BorderLayout()); tabs.addTab("Run",runPanel); JPanel runTB=new JPanel(); runPanel.add(runTB,BorderLayout.NORTH); mBtnAdb=new JButton("Fetch from device"); mBtnAdb.setEnabled(false); runTB.add(mBtnAdb); mDropArea=new JLabel("Drop a bugreport file here!",JLabel.CENTER); runPanel.add(mDropArea,BorderLayout.CENTER); mDropArea.setBorder(BorderFactory.createLoweredBevelBorder()); mDropArea.setTransferHandler(new MyTransferHandler()); mStatus=new JLabel("Ready."); runPanel.add(mStatus,BorderLayout.SOUTH); mAdbExt=mMain.findExtension("AdbExtension"); if (mAdbExt != null) { mBtnAdb.setEnabled(true); mBtnAdb.addActionListener(this); } JPanel settingsPanel=new JPanel(); settingsPanel.setLayout(new BoxLayout(settingsPanel,BoxLayout.Y_AXIS)); tabs.addTab("Settings",settingsPanel); buildSettings(settingsPanel); setSize(640,480); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); }
Example 20
From project Clotho-Core, under directory /ClothoApps/LabEditor/src/org/clothocad/tool/labeditor/.
Source file: blueTextArea.java

public blueTextArea(String fieldname,String initialvalue,int height){ fieldName=fieldname; oldValue=initialvalue; setLayout(new BorderLayout()); setMaximumSize(new Dimension(textfieldwidth + labelwidth,height)); setPreferredSize(new Dimension(textfieldwidth + labelwidth,height)); setOpaque(false); label=new JLabel(fieldName); label.setForeground(Color.WHITE); label.setFont(new java.awt.Font("Arial",Font.BOLD,textsize)); label.setPreferredSize(new Dimension(labelwidth,2 * textsize)); JPanel panel=new JPanel(); panel.setOpaque(false); panel.add(label); add(panel,BorderLayout.WEST); textArea=new JTextArea(); textArea.setBackground(navyblue); textArea.setFont(new java.awt.Font("Arial",Font.PLAIN,textsize)); textArea.setForeground(Color.WHITE); textArea.setBorder(null); textArea.setText(initialvalue); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.addFocusListener(this); textArea.setPreferredSize(new Dimension(textfieldwidth,2 * textsize)); add(textArea,BorderLayout.EAST); }
Example 21
From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.
Source file: BroadcastFileContentsDetailWindow.java

private void manageOptionPanel() throws RequestException { if (sectionId.getSelectedIndex() == -1) { removeOptionalTab(); pref=null; } else { String family=sectionId.getSelectedValue("family"); if (pref == null || !family.equals(pref.getFamily())) { removeOptionalTab(); pref=guiPrefManager.getPreferenceFor(family); JPanel optionPanel=pref.buildContentOptionPanel(dataSource); if (optionPanel != null) { this.sectionTabPanel.addTab("Options",optionPanel); } } } }
Example 22
From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/plugin/.
Source file: DefaultQuarantineWindow.java

private void initLayout(){ waitingPanel=new WaitingPanel(translate("DefaultQuarantineWindow.waitingPanel",guiContext)); setGlassPane(waitingPanel); JScrollPane scrollPane=new JScrollPane(); scrollPane.getViewport().add(requestTable,null); JPanel mainPanel=new JPanel(new BorderLayout()); mainPanel.add(scrollPane,BorderLayout.CENTER); toolBar=new RequestToolBar(); toolBar.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel=new JPanel(new BorderLayout()); bottomPanel.add(toolBar,BorderLayout.CENTER); filterPanel=new QuarantineFilterPanel(requestTable); filterPanel.setWithSearchButton(false); filterPanel.setPostponedLoad(true); filterPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(134,134,134)),translate("DefaultQuarantineWindow.filterPanel.title",guiContext))); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(mainPanel,BorderLayout.CENTER); this.getContentPane().add(bottomPanel,BorderLayout.SOUTH); this.getContentPane().add(filterPanel,BorderLayout.NORTH); final WindowData window=guiData.getWindow(); setPreferredSize(new Dimension(window.getWindowWidth(),window.getWindowHeight())); }
Example 23
From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/.
Source file: ExplorerTableWindow.java

/** * Construit le tree de navigation avec un parametre d'affichage * @param choixAffiche Description of the Parameter * @throws Exception Description of the Exception */ private void treeConstructor(String choixAffiche) throws Exception { final String variable=choixAffiche; Border border1=BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134)); TitledBorder titledBorder1=new TitledBorder(border1,"Type d'affichage"); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.putClientProperty("JTree.lineStyle","Angled"); tree.setShowsRootHandles(true); tree.setCellRenderer(new ExplorerTableRenderer()); ToolTipManager.sharedInstance().registerComponent(tree); setFrameIcon(UIManager.getIcon("dbExplorer.FreeTable")); this.setEnabled(true); this.setPreferredSize(new Dimension(340,630)); JScrollPane scrollPane=new JScrollPane(tree); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); textArea.setEditable(false); JSplitPane splitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT,scrollPane,textArea); splitPane.setOneTouchExpandable(true); splitPane.setDividerSize(10); splitPane.setDividerLocation(510); JPanel panel=new JPanel(new BorderLayout()); choix.setBorder(titledBorder1); choix.setLayout(borderLayout1); panel.add(splitPane,BorderLayout.CENTER); panel.add(choix,BorderLayout.NORTH); choix.add(comboChoice,BorderLayout.CENTER); this.getContentPane().add(panel,null); setContentPane(panel); tree.addMouseListener(getMouseListener(variable)); this.setSize(this.getSize()); }
Example 24
From project cp-common-utils, under directory /src/com/clarkparsia/common/net/.
Source file: VisualAuthenticator.java

/** * @inheritDoc */ @Override protected PasswordAuthentication getPasswordAuthentication(){ JTextField aUser=new JTextField(); JTextField aPassword=new JPasswordField(); JLabel aUserLabel=new JLabel("User"); aUserLabel.setLabelFor(aUserLabel); JLabel aPasswordLabel=new JLabel("Password"); aPasswordLabel.setLabelFor(aPassword); JPanel aPanel=new JPanel(new GridLayout(2,2)); aPanel.add(aUserLabel); aPanel.add(aUser); aPanel.add(aPasswordLabel); aPanel.add(aPassword); int aOption=JOptionPane.showConfirmDialog(null,new Object[]{"Host: " + getRequestingHost(),"Realm: " + getRequestingPrompt(),aPanel},"Authorization Required",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE); if (aOption == JOptionPane.OK_OPTION) { return new PasswordAuthentication(aUser.getText(),aPassword.getText().toCharArray()); } else { return null; } }
Example 25
From project cytoscape-plugins, under directory /org.openbel.cytoscape.navigator/src/org/openbel/cytoscape/navigator/dialog/.
Source file: SearchKamDialog.java

private JPanel createButtonPanel(){ JPanel bp=new JPanel(); bp.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); cancelBtn=new JButton(); cancelBtn.addActionListener(this); cancelBtn.setText("Cancel"); cancelBtn.setPreferredSize(new java.awt.Dimension(85,25)); bp.add(cancelBtn); searchBtn=new JButton(); searchBtn.addActionListener(this); searchBtn.setText("Search"); searchBtn.setPreferredSize(new java.awt.Dimension(85,25)); bp.add(searchBtn); addBtn=new JButton(); addBtn.addActionListener(this); addBtn.setText("Add"); addBtn.setPreferredSize(new java.awt.Dimension(85,25)); bp.add(addBtn); return bp; }
Example 26
From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.
Source file: JCalendar.java

/** * JCalendar constructor with month spinner parameter. * @param monthSpinner Possible values are JMonthChooser.RIGHT_SPINNER,JMonthChooser.LEFT_SPINNER, JMonthChooser.NO_SPINNER */ public JCalendar(int monthSpinner){ dayChooser=null; monthChooser=null; yearChooser=null; locale=Locale.getDefault(); calendar=Calendar.getInstance(); setLayout(new BorderLayout()); JPanel myPanel=new JPanel(); myPanel.setLayout(new GridLayout(1,3)); monthChooser=new JMonthChooser(monthSpinner); yearChooser=new JYearChooser(); monthChooser.setYearChooser(yearChooser); myPanel.add(monthChooser); myPanel.add(yearChooser); dayChooser=new JDayChooser(); dayChooser.addPropertyChangeListener(this); monthChooser.setDayChooser(dayChooser); monthChooser.addPropertyChangeListener(this); yearChooser.setDayChooser(dayChooser); yearChooser.addPropertyChangeListener(this); add(myPanel,BorderLayout.NORTH); add(dayChooser,BorderLayout.CENTER); initialized=true; }
Example 27
public String[] promptKeyboardInteractive(String destination,String name,String instruction,String[] prompt,boolean[] echo){ panel=new JPanel(); panel.setLayout(new GridBagLayout()); gbc.weightx=1.0; gbc.gridwidth=GridBagConstraints.REMAINDER; gbc.gridx=0; panel.add(new JLabel(instruction),gbc); gbc.gridy++; gbc.gridwidth=GridBagConstraints.RELATIVE; JTextField[] texts=new JTextField[prompt.length]; for (int i=0; i < prompt.length; i++) { gbc.fill=GridBagConstraints.NONE; gbc.gridx=0; gbc.weightx=1; panel.add(new JLabel(prompt[i]),gbc); gbc.gridx=1; gbc.fill=GridBagConstraints.HORIZONTAL; gbc.weighty=1; if (echo[i]) { texts[i]=new JTextField(20); } else { texts[i]=new JPasswordField(20); } panel.add(texts[i],gbc); gbc.gridy++; } if (JOptionPane.showConfirmDialog(null,panel,destination + ": " + name,JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { String[] response=new String[prompt.length]; for (int i=0; i < prompt.length; i++) { response[i]=texts[i].getText(); } return response; } else { return null; } }
Example 28
/** * Show a tool tip. * @param tipText the tool tip text * @param pt the pixel position over which to show the tip */ public void showTip(String tipText,Point pt){ if (getRootPane() == null) return; if (glassPane == null) { getRootPane().setGlassPane(glassPane=new JPanel()); glassPane.setOpaque(false); glassPane.setLayout(null); glassPane.add(tip=new JToolTip()); tipTimer=new Timer(TIP_DELAY,new ActionListener(){ public void actionPerformed( ActionEvent evt){ glassPane.setVisible(false); } } ); tipTimer.setRepeats(false); } if (tipText == null) return; tip.setTipText(tipText); tip.setLocation(SwingUtilities.convertPoint(this,pt,glassPane)); tip.setSize(tip.getPreferredSize()); glassPane.setVisible(true); glassPane.repaint(); tipTimer.restart(); }
Example 29
From project CloudReports, under directory /src/main/java/cloudreports/gui/.
Source file: MainView.java

/** * Adds a panel to the card layout. * @param name the name of the new panel. * @param panel the new panel. * @since 1.0 */ public boolean addTabbedPanel(String name,JPanel panel){ Component[] components=cardPanel.getComponents(); for ( Component c : components) { if (c.getName() != null && c.getName().equals(name)) return false; } cardPanel.add(name,panel); return true; }
Example 30
From project advanced, under directory /management/src/main/java/org/neo4j/management/impl/jconsole/.
Source file: Neo4jPlugin.java

@Override public Map<String,JPanel> getTabs(){ ManagementAccess[] managers=ManagementAccess.getAll(getContext().getMBeanServerConnection()); Map<String,JPanel> result=new LinkedHashMap<String,JPanel>(); if (managers.length == 1) { addTabs(managers[0],"",result); } else { for ( ManagementAccess manager : managers) { addTabs(manager," (" + manager.getMBeanQuery().getKeyProperty("instance") + ")",result); } } return result; }
Example 31
public Input(BFrame frame){ frame.canvas.addMouseMotionListener(this); frame.canvas.addMouseListener(this); frame.canvas.addMouseWheelListener(this); frame.canvas.addKeyListener(this); size=new Dimension(); size.width=((JPanel)frame.getContentPane()).getWidth(); size.height=((JPanel)frame.getContentPane()).getHeight(); pressedKeys=new HashMap<Integer,Remover>(); keyBuffer=new ArrayList<Character>(); timer=new Timer(); }