List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:org.openconcerto.erp.core.finance.accounting.element.AssociationCompteAnalytiqueSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.weightx = 1;/*ww w . j a v a 2s . com*/ c.weighty = 1; c.fill = GridBagConstraints.BOTH; final List<ClasseCompte> classeComptes = new ArrayList<ClasseCompte>(); tabbedClasse = new JTabbedPane(); final SQLTable classeCompteTable = getTable().getBase().getTable("CLASSE_COMPTE"); final SQLSelect selClasse = new SQLSelect(); selClasse.addSelect(classeCompteTable.getField("ID")); selClasse.addSelect(classeCompteTable.getField("NOM")); selClasse.addSelect(classeCompteTable.getField("TYPE_NUMERO_COMPTE")); selClasse.addRawOrder("TYPE_NUMERO_COMPTE"); String reqClasse = selClasse.asString(); Object obClasse = getTable().getBase().getDataSource().execute(reqClasse, new ArrayListHandler()); List<Object[]> myListClasse = (List<Object[]>) obClasse; for (Object[] objTmp : myListClasse) { ClasseCompte ccTmp = new ClasseCompte(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString(), objTmp[2].toString()); classeComptes.add(ccTmp); tabbedClasse.add(ccTmp.getNom(), new JScrollPane(creerJTable(ccTmp))); } this.add(tabbedClasse, c); final SQLTableModifiedListener tListener = new SQLTableModifiedListener() { @Override public void tableModified(SQLTableEvent evt) { final int tabCount = tabbedClasse.getTabCount(); for (int i = 0; i < tabCount; i++) { tabbedClasse.setComponentAt(i, new JScrollPane(creerJTable(classeComptes.get(i)))); } } }; final SQLTable tAxeAnalytique = getElement().getDirectory() .getElement(AxeAnalytiqueSQLElement.class).getTable(); tAxeAnalytique.addTableModifiedListener(tListener); final SQLTable tRepartitionAnalytique = getElement().getDirectory() .getElement(RepartitionAnalytiqueSQLElement.class).getTable(); tRepartitionAnalytique.addTableModifiedListener(tListener); final SQLTable tRepartitionAnalytiqueElement = getElement().getDirectory() .getElement(RepartitionAnalytiqueElementSQLElement.class).getTable(); tRepartitionAnalytiqueElement.addTableModifiedListener(tListener); final SQLTable tComptePCE = getElement().getDirectory().getElement(ComptePCESQLElement.class) .getTable(); tComptePCE.addTableModifiedListener(tListener); } }; }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
public EtatJournauxPanel() { super();//from ww w .j a v a 2 s . c o m this.tabbedJournaux = new JTabbedPane(); this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = 2; c.gridheight = 1; c.weightx = 1; c.weighty = 1; this.add(this.tabbedJournaux, c); JButton buttonImpression = new JButton("Impression"); JButton buttonClose = new JButton("Fermer"); c.gridx = 0; c.gridy++; c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; this.add(buttonImpression, c); c.gridx++; c.weightx = 0; this.add(buttonClose, c); buttonClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((JFrame) SwingUtilities.getRoot(EtatJournauxPanel.this)).dispose(); }; }); buttonImpression.addActionListener(new ImpressionJournauxAction()); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java
public GrandLivrePanel() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.weightx = 1;//from w w w . jav a 2 s. c o m this.tabbedClasse = new JTabbedPane(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; this.add(this.tabbedClasse, c); JButton buttonImpression = new JButton("Impression"); JButton buttonClose = new JButton("Fermer"); c.gridx = 0; c.gridy++; c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; this.add(buttonImpression, c); c.gridx++; c.weightx = 0; this.add(buttonClose, c); buttonClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((JFrame) SwingUtilities.getRoot(GrandLivrePanel.this)).dispose(); }; }); buttonImpression.addActionListener(new ImpressionGrandLivreAction()); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Initializes the components composing the display. * /*ww w . ja va 2 s . c om*/ * @param filters The filters to handle. * @param importerAction The cancel-all-imports action. */ private void initComponents(FileFilter[] filters, ImporterAction importerAction) { canvas = new QuotaCanvas(); sizeImportLabel = new JLabel(); diskSpacePane = new JPanel(); diskSpacePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); diskSpacePane.add(UIUtilities.setTextFont(TEXT_FREE_SPACE)); diskSpacePane.add(canvas); showThumbnails = new JCheckBox(TEXT_SHOW_THUMBNAILS); showThumbnails.setVisible(false); Registry registry = ImporterAgent.getRegistry(); Boolean loadThumbnails = (Boolean) registry.lookup(LOAD_THUMBNAIL); if (loadThumbnails != null) { if (loadThumbnails.booleanValue()) { showThumbnails.setVisible(true); showThumbnails.setSelected(loadThumbnails.booleanValue()); } } if (!isFastConnection()) // slow connection showThumbnails.setSelected(false); long groupId = -1; if (model.getSelectedGroup() != null) groupId = model.getSelectedGroup().getGroupId(); if (groupId < 0) groupId = ImporterAgent.getUserDetails().getGroupId(); locationDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, true); locationDialog.addPropertyChangeListener(this); int plugin = ImporterAgent.runAsPlugin(); if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) { detachedDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, false); detachedDialog.addPropertyChangeListener(this); } tagSelectionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src instanceof JButton) { TagAnnotationData tag = tagsMap.get(src); if (tag != null) { tagsMap.remove(src); handleTagsSelection(tagsMap.values()); } } } }; tabbedPane = new JTabbedPane(); numberOfFolders = new NumericalTextField(); numberOfFolders.setMinimum(0); numberOfFolders.setText("0"); numberOfFolders.setColumns(3); numberOfFolders.addPropertyChangeListener(this); tagsMap = new LinkedHashMap<JButton, TagAnnotationData>(); IconManager icons = IconManager.getInstance(); refreshFilesButton = new JButton(TEXT_REFRESH_FILES); refreshFilesButton.setBackground(UIUtilities.BACKGROUND); refreshFilesButton.setToolTipText(TOOLTIP_REFRESH_FILES); refreshFilesButton.setActionCommand("" + CMD_REFRESH_FILES); refreshFilesButton.addActionListener(this); tagButton = new JButton(icons.getIcon(IconManager.PLUS_12)); UIUtilities.unifiedButtonLookAndFeel(tagButton); tagButton.addActionListener(this); tagButton.setActionCommand("" + CMD_TAG); tagButton.setToolTipText(TOOLTIP_ADD_TAGS); tagsPane = new JPanel(); tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS)); overrideName = new JCheckBox(TEXT_OVERRIDE_FILE_NAMING); overrideName.setToolTipText(UIUtilities.formatToolTipText(WARNING)); overrideName.setSelected(true); ButtonGroup group = new ButtonGroup(); fullName = new JRadioButton(TEXT_NAMING_FULL_PATH); group.add(fullName); partialName = new JRadioButton(); partialName.setText(TEXT_NAMING_PARTIAL_PATH); partialName.setSelected(true); group.add(partialName); table = new FileSelectionTable(this); table.addPropertyChangeListener(this); chooser = new GenericFileChooser(); JList list = (JList) UIUtilities.findComponent(chooser, JList.class); KeyAdapter ka = new KeyAdapter() { /** * Adds the files to the import queue. * * @see KeyListener#keyPressed(KeyEvent) */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { handleEnterKeyPressed(e.getSource()); } } }; if (list != null) list.addKeyListener(ka); if (list == null) { JTable t = (JTable) UIUtilities.findComponent(chooser, JTable.class); if (t != null) t.addKeyListener(ka); } try { File f = UIUtilities.getDefaultFolder(); if (f != null) chooser.setCurrentDirectory(f); } catch (Exception e) { // Ignore: could not set the default container } chooser.addPropertyChangeListener(this); chooser.setMultiSelectionEnabled(true); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setControlButtonsAreShown(false); chooser.setApproveButtonText(TEXT_IMPORT); chooser.setApproveButtonToolTipText(TOOLTIP_IMPORT); bioFormatsFileFilters = new ArrayList<FileFilter>(); if (filters != null) { chooser.setAcceptAllFileFilterUsed(false); for (FileFilter fileFilter : filters) { if (fileFilter instanceof ComboFileFilter) { bioFormatsFileFiltersCombined = fileFilter; ComboFileFilter comboFilter = (ComboFileFilter) fileFilter; FileFilter[] extensionFilters = comboFilter.getFilters(); for (FileFilter combinedFilter : extensionFilters) { bioFormatsFileFilters.add(combinedFilter); } break; } } chooser.addChoosableFileFilter(bioFormatsFileFiltersCombined); for (FileFilter fileFilter : bioFormatsFileFilters) { chooser.addChoosableFileFilter(fileFilter); } chooser.setFileFilter(bioFormatsFileFiltersCombined); } else { chooser.setAcceptAllFileFilterUsed(true); } closeButton = new JButton(TEXT_CLOSE); closeButton.setToolTipText(TOOLTIP_CLOSE); closeButton.setActionCommand("" + CMD_CLOSE); closeButton.addActionListener(this); cancelImportButton = new JButton(importerAction); importerAction.setEnabled(false); importButton = new JButton(TEXT_IMPORT); importButton.setToolTipText(TOOLTIP_IMPORT); importButton.setActionCommand("" + CMD_IMPORT); importButton.addActionListener(this); importButton.setEnabled(false); pixelsSize = new ArrayList<NumericalTextField>(); NumericalTextField field; for (int i = 0; i < 3; i++) { field = new NumericalTextField(); field.setNumberType(Double.class); field.setColumns(2); pixelsSize.add(field); } List<Component> boxes = UIUtilities.findComponents(chooser, JComboBox.class); if (boxes != null) { JComboBox box; JComboBox filterBox = null; Iterator<Component> i = boxes.iterator(); while (i.hasNext()) { box = (JComboBox) i.next(); Object o = box.getItemAt(0); if (o instanceof FileFilter) { filterBox = box; break; } } if (filterBox != null) { filterBox.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { String value = KeyEvent.getKeyText(e.getKeyCode()); JComboBox box = (JComboBox) e.getSource(); int n = box.getItemCount(); FileFilter filter; FileFilter selectedFilter = null; String d; for (int j = 0; j < n; j++) { filter = (FileFilter) box.getItemAt(j); d = filter.getDescription(); if (d.startsWith(value)) { selectedFilter = filter; break; } } if (selectedFilter != null) box.setSelectedItem(selectedFilter); } }); } } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.LocationDialog.java
/** * Builds a TabbedPane holding the Screen / Project import sections * @return The tab panel for Screen / Project selection */// w w w . j a va 2 s . c om private JPanel buildDataTypeTabbedPane() { IconManager icons = IconManager.getInstance(); Icon projectIcon = icons.getIcon(IconManager.PROJECT); projectPanel = buildProjectSelectionPanel(); Icon screenIcon = icons.getIcon(IconManager.SCREEN); screenPanel = buildScreenSelectionPanel(); tabbedPane = new JTabbedPane(); tabbedPane.addTab(TEXT_PROJECTS, projectIcon, projectPanel, TOOLTIP_PROJECTS_TAB); tabbedPane.addTab(TEXT_SCREENS, screenIcon, screenPanel, TOOLTIP_SCREENS_TAB); tabbedPane.addChangeListener(this); return wrapInGapPanel(tabbedPane); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorUI.java
/** Initializes the UI components. */ private void initComponents() { dummyPanel = new JPanel(); groupUI = new GroupProfile(model, this); groupUI.addPropertyChangeListener(controller); userUI = new UserUI(model, controller, this); toolBar = new ToolBar(model, controller); generalPane = new GeneralPaneUI(this, model, controller, toolBar); acquisitionPane = new AcquisitionDataUI(this, model, controller); tabPane = new JTabbedPane(); tabPane.addChangeListener(controller); tabPane.setBackground(UIUtilities.BACKGROUND_COLOR); populateTabbedPane(true);/*w w w. ja va2s . c o m*/ tabPane.setEnabledAt(ACQUISITION_INDEX, false); defaultPane = new JPanel(); defaultPane.setBackground(UIUtilities.BACKGROUND_COLOR); component = defaultPane; userTabbedPane = new JScrollPane(userUI); groupTabbedPane = new JScrollPane(groupUI); }
From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java
/** * Builds the UI component hosting the debug information. * //from ww w .ja va 2s . co m * @param toSubmit The collection of files to send. * @return See above */ private JTabbedPane buildExceptionPane(List<ImportErrorObject> toSubmit) { JTabbedPane tPane = new JTabbedPane(); tPane.setOpaque(false); //tPane.setBackground(UIUtilities.WINDOW_BACKGROUND_COLOR); if (dialogType == SUBMIT_ERROR_TYPE) { tPane.addTab("Comments", null, buildCommentPane(COMMENT_FIELD), "Your comments go here."); tPane.addTab("Files to Send", null, buildFilesToSubmitPane(toSubmit), "The files to send to the development team."); } else { tPane.addTab("Comments", null, buildCommentPane(DEBUG_COMMENT_FIELD), "Your comments go here."); tPane.addTab("Error Message", null, buildDebugPane(), "The Exception Message."); } return tPane; }
From source file:org.openstatic.irc.client.O5Client.java
public O5Client() { super("O5 IRC"); this.chat_panels = new Hashtable<String, O5ChatPanel>(); this.server_panels = new Hashtable<String, O5ServerPanel>(); this.token_id = null; this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(WindowEvent winEvt) { System.exit(0);/*w ww . j a v a 2s.c o m*/ } }); this.tabbed = new JTabbedPane(); JPanel main_pane = new JPanel(); main_pane.setLayout(new BorderLayout()); // Setup tab JPanel pane = new JPanel(new GridLayout(0, 2, 6, 6)); pane.setSize(50, 100); JLabel server_label = new JLabel("Server:", JLabel.TRAILING); server_field = new JTextField(15); server_field.setText("127.0.0.1:4050"); JLabel username_label = new JLabel("Username:", JLabel.TRAILING); username_field = new JTextField(15); JLabel password_label = new JLabel("Password:", JLabel.TRAILING); password_field = new JTextField(15); login_btn = new JButton("Connect"); login_btn.setActionCommand("login"); login_btn.addActionListener(this); pane.add(server_label); pane.add(server_field); pane.add(username_label); pane.add(username_field); pane.add(password_label); pane.add(password_field); pane.add(new JLabel("")); pane.add(login_btn); JPanel page_start = new JPanel(new BorderLayout()); JLabel page_header = new JLabel("O5 Client"); page_header.setFont(new Font("Monospaced", Font.BOLD, 36)); page_start.add(page_header, BorderLayout.PAGE_START); page_start.add(pane, BorderLayout.PAGE_END); main_pane.add(page_start, BorderLayout.PAGE_START); tabbed.addTab("Connect", null, main_pane, ""); // finish window this.add(tabbed); centerWindow(); this.setVisible(true); }
From source file:org.optaplanner.examples.coachshuttlegathering.swingui.CoachShuttleGatheringPanel.java
public CoachShuttleGatheringPanel() { setLayout(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); coachShuttleGatheringWorldPanel = new CoachShuttleGatheringWorldPanel(this); coachShuttleGatheringWorldPanel.setPreferredSize(PREFERRED_SCROLLABLE_VIEWPORT_SIZE); tabbedPane.add("World", coachShuttleGatheringWorldPanel); add(tabbedPane, BorderLayout.CENTER); }
From source file:org.optaplanner.examples.meetingscheduling.swingui.MeetingSchedulingPanel.java
public MeetingSchedulingPanel() { setLayout(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); roomsPanel = new TimeTablePanel<>(); tabbedPane.add("Rooms", new JScrollPane(roomsPanel)); personsPanel = new TimeTablePanel<>(); tabbedPane.add("Persons", new JScrollPane(personsPanel)); add(tabbedPane, BorderLayout.CENTER); setPreferredSize(PREFERRED_SCROLLABLE_VIEWPORT_SIZE); }