List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:org.kuali.test.ui.components.panels.WebTestPanel.java
@Override protected void initComponents() { super.initComponents(); tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); add(tabbedPane, BorderLayout.CENTER); }
From source file:org.kuali.test.ui.components.sqlquerypanel.DatabasePanel.java
@Override protected void initComponents() { super.initComponents(); JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); p.add(new JLabel("Base Table:", JLabel.RIGHT)); p.add(tableDropdown = new JComboBox()); p.add(spinner = new Spinner("Loading available database tables...")); new SwingWorker() { @Override// ww w . j av a 2 s .c o m protected Object doInBackground() throws Exception { loadAvailableDatabaseTables(); return null; }; @Override protected void done() { spinner.stopSpinner(); tableDropdown.addActionListener(DatabasePanel.this); } }.execute(); JPanel p2 = new JPanel(new BorderLayout()); p2.add(p, BorderLayout.NORTH); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Columns", new JScrollPane(sqlQueryTree = new SqlQueryTree(getMainframe(), this, getPlatform()))); tabbedPane.addTab("Select", sqlSelectPanel = new SqlSelectPanel(getMainframe(), this)); tabbedPane.addTab("Where", sqlWherePanel = new SqlWherePanel(getMainframe(), this)); tabbedPane.addTab("SQL", sqlDisplayPanel = new SqlDisplayPanel(getMainframe(), this)); p2.add(tabbedPane, BorderLayout.CENTER); add(p2, BorderLayout.CENTER); if (!forCheckpoint) { getMainframe().getCreateTestButton().setEnabled(false); getMainframe().getCreateTestMenuItem().setEnabled(false); } }
From source file:org.languagetool.gui.ConfigurationDialog.java
public boolean show(List<Rule> rules) { configChanged = false;//from w w w .ja va 2 s . c o m if (original != null) { config.restoreState(original); } dialog = new JDialog(owner, true); dialog.setTitle(messages.getString("guiConfigWindowTitle")); // close dialog when user presses Escape key: KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent actionEvent) { dialog.setVisible(false); } }; JRootPane rootPane = dialog.getRootPane(); rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); configurableRules.clear(); Language lang = config.getLanguage(); if (lang == null) { lang = Languages.getLanguageForLocale(Locale.getDefault()); } String specialTabNames[] = config.getSpecialTabNames(); int numConfigTrees = 2 + specialTabNames.length; configTree = new JTree[numConfigTrees]; JPanel checkBoxPanel[] = new JPanel[numConfigTrees]; DefaultMutableTreeNode rootNode; GridBagConstraints cons; for (int i = 0; i < numConfigTrees; i++) { checkBoxPanel[i] = new JPanel(); cons = new GridBagConstraints(); checkBoxPanel[i].setLayout(new GridBagLayout()); cons.anchor = GridBagConstraints.NORTHWEST; cons.gridx = 0; cons.weightx = 1.0; cons.weighty = 1.0; cons.fill = GridBagConstraints.HORIZONTAL; Collections.sort(rules, new CategoryComparator()); if (i == 0) { rootNode = createTree(rules, false, null); // grammar options } else if (i == 1) { rootNode = createTree(rules, true, null); // Style options } else { rootNode = createTree(rules, true, specialTabNames[i - 2]); // Special tab options } configTree[i] = new JTree(getTreeModel(rootNode)); configTree[i].applyComponentOrientation(ComponentOrientation.getOrientation(lang.getLocale())); configTree[i].setRootVisible(false); configTree[i].setEditable(false); configTree[i].setCellRenderer(new CheckBoxTreeCellRenderer()); TreeListener.install(configTree[i]); checkBoxPanel[i].add(configTree[i], cons); configTree[i].addMouseListener(getMouseAdapter()); } JPanel portPanel = new JPanel(); portPanel.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; cons.gridy = 0; cons.anchor = GridBagConstraints.WEST; cons.fill = GridBagConstraints.NONE; cons.weightx = 0.0f; if (!insideOffice) { createNonOfficeElements(cons, portPanel); } else { createOfficeElements(cons, portPanel); } JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); JButton okButton = new JButton(Tools.getLabel(messages.getString("guiOKButton"))); okButton.setMnemonic(Tools.getMnemonic(messages.getString("guiOKButton"))); okButton.setActionCommand(ACTION_COMMAND_OK); okButton.addActionListener(this); JButton cancelButton = new JButton(Tools.getLabel(messages.getString("guiCancelButton"))); cancelButton.setMnemonic(Tools.getMnemonic(messages.getString("guiCancelButton"))); cancelButton.setActionCommand(ACTION_COMMAND_CANCEL); cancelButton.addActionListener(this); cons = new GridBagConstraints(); cons.insets = new Insets(0, 4, 0, 0); buttonPanel.add(okButton, cons); buttonPanel.add(cancelButton, cons); JTabbedPane tabpane = new JTabbedPane(); JPanel jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 0.0f; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.NORTHWEST; cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(getMotherTonguePanel(cons), cons); if (insideOffice) { cons.gridy += 3; } else { cons.gridy++; } cons.anchor = GridBagConstraints.WEST; jPane.add(getNgramPanel(cons), cons); cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(getWord2VecPanel(cons), cons); cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(portPanel, cons); cons.fill = GridBagConstraints.HORIZONTAL; cons.anchor = GridBagConstraints.WEST; for (JPanel extra : extraPanels) { //in case it wasn't in a containment hierarchy when user changed L&F SwingUtilities.updateComponentTreeUI(extra); cons.gridy++; jPane.add(extra, cons); } cons.gridy++; cons.fill = GridBagConstraints.BOTH; cons.weighty = 1.0f; jPane.add(new JPanel(), cons); tabpane.addTab(messages.getString("guiGeneral"), jPane); jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[0]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(0), cons); tabpane.addTab(messages.getString("guiGrammarRules"), jPane); jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[1]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(1), cons); cons.gridx = 0; cons.gridy++; cons.weightx = 5.0f; cons.weighty = 5.0f; cons.fill = GridBagConstraints.BOTH; cons.anchor = GridBagConstraints.WEST; jPane.add(new JScrollPane(getSpecialRuleValuePanel()), cons); tabpane.addTab(messages.getString("guiStyleRules"), jPane); for (int i = 0; i < specialTabNames.length; i++) { jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[i + 2]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(i + 2), cons); tabpane.addTab(specialTabNames[i], jPane); } jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; if (insideOffice) { JLabel versionText = new JLabel(messages.getString("guiUColorHint")); versionText.setForeground(Color.blue); jPane.add(versionText, cons); cons.gridy++; } cons.weightx = 2.0f; cons.weighty = 2.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(getUnderlineColorPanel(rules)), cons); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; cons.anchor = GridBagConstraints.NORTHWEST; contentPane.add(tabpane, cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.EAST; contentPane.add(buttonPanel, cons); dialog.pack(); // center on screen: Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dialog.getSize(); dialog.setLocation(screenSize.width / 2 - frameSize.width / 2, screenSize.height / 2 - frameSize.height / 2); dialog.setLocationByPlatform(true); // add Color tab after dimension was set tabpane.addTab(messages.getString("guiUnderlineColor"), jPane); for (JPanel extra : this.extraPanels) { if (extra instanceof SavablePanel) { ((SavablePanel) extra).componentShowing(); } } dialog.setVisible(true); return configChanged; }
From source file:org.mbs3.juniuploader.gui.frmMain.java
private void initGUI() { try {//www .j a v a 2s. c o m BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setTitle("jUniUploader " + jUniUploader.VERSION); { lblStatus = new JLabel(); getContentPane().add(lblStatus, BorderLayout.SOUTH); lblStatus.setText("Lots of status text will go here"); lblStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setPreferredSize(new java.awt.Dimension(665, 402)); { pnlMainMenu1 = new pnlMainMenu(); jTabbedPane1.addTab("Main Menu", null, getPnlMainMenu1(), null); } { pnlWoWDirectories1 = new pnlWoWDirectories(); jTabbedPane1.addTab("WoW Directories", null, getPnlWoWDirectories1(), null); } { pnlRemoteInterface1 = new pnlRemoteInterface(); jTabbedPane1.addTab("UniAdmin Interface", null, getPnlRemoteInterface1(), null); } { pnlUploadSites1 = new pnlUploadSites(); jTabbedPane1.addTab("Upload Sites", null, getPnlUploadSites1(), null); } { pnlFormVariables1 = new pnlFormVariables(); jTabbedPane1.addTab("Form Variables", null, getPnlFormVariables1(), null); } { pnlUploadRules1 = new pnlUploadRules(); jTabbedPane1.addTab("Upload Rules", null, getPnlUploadRules1(), null); } { pnlDebug1 = new pnlDebug(); jTabbedPane1.addTab("Debug Log", null, pnlDebug1, null); } { pnlLoggingOptions1 = new pnlSettings(); jTabbedPane1.addTab("Application Settings", null, getPnlLoggingOptions1(), null); } { pnlAbout1 = new pnlAbout(); jTabbedPane1.addTab("About", null, getPnlAbout1(), null); } } this.setSize(673, 456); jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText("File"); newFileMenuItem = new JMenuItem(); jMenu3.add(newFileMenuItem); newFileMenuItem.setText("New"); openFileMenuItem = new JMenuItem(); jMenu3.add(openFileMenuItem); openFileMenuItem.setText("Open"); saveMenuItem = new JMenuItem(); jMenu3.add(saveMenuItem); saveMenuItem.setText("Save"); saveAsMenuItem = new JMenuItem(); jMenu3.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); closeFileMenuItem = new JMenuItem(); jMenu3.add(closeFileMenuItem); closeFileMenuItem.setText("Close"); jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); jMenu4.setEnabled(false); cutMenuItem = new JMenuItem(); jMenu4.add(cutMenuItem); cutMenuItem.setText("Cut"); copyMenuItem = new JMenuItem(); jMenu4.add(copyMenuItem); copyMenuItem.setText("Copy"); pasteMenuItem = new JMenuItem(); jMenu4.add(pasteMenuItem); pasteMenuItem.setText("Paste"); jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } catch (Exception ex) { log.error("Error", ex); } }
From source file:org.n52.ifgicopter.spf.gui.SPFMainFrame.java
/** * the gui representation of the framework *///from w w w . ja v a 2s . co m public SPFMainFrame() { /* * handled by worker thread. */ this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.setTitle("Sensor Platform Framework"); this.menu = new JMenuBar(); try { File f = new File("img/icon.png"); InputStream in; if (!f.exists()) { in = ImageMapMarker.class.getResourceAsStream("/img/icon.png"); } else { in = new FileInputStream(f); } this.setIconImage(ImageIO.read(in)); } catch (IOException e) { this.log.warn(e.getMessage(), e); } /* * simple menu bar */ JMenu file = new JMenu("File"); JMenuItem exit = new JMenuItem("Exit"); /* * shutdown the engine if closed */ exit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { shutdownFrame(); } }); this.pnp = new JCheckBoxMenuItem("Plug'n'Play mode"); this.pnp.setSelected(false); /* * switch the pnp mode */ this.pnp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean flag = SPFMainFrame.this.pnp.isSelected(); if (flag && !SPFMainFrame.this.dontShow) { JCheckBox checkbox = new JCheckBox("Do not show this message again."); String message = "During Plug'n'Play mode the output generation is blocked."; Object[] params = { message, checkbox }; JOptionPane.showMessageDialog(SPFMainFrame.this, params); SPFMainFrame.this.dontShow = checkbox.isSelected(); } /* * check if we need to restart the output plugins */ if (!flag && SPFMainFrame.this.inputChanged) { SPFRegistry.getInstance().restartOutputPlugins(); } SPFRegistry.getInstance().setPNPMode(flag); } }); JMenuItem restart = new JMenuItem("Restart"); restart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { shutdownFrame(RESTART_CODE); } }); JMenuItem managePlugins = new JMenuItem("Manage available Plugins"); managePlugins.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginRegistrationDialog prd = new PluginRegistrationDialog(SPFMainFrame.this); if (prd.isCanceled()) return; updateConfigurationFile(prd.getSelectedNewPlugins(), prd.getSelectedOldPlugins()); int ret = JOptionPane.showConfirmDialog(SPFMainFrame.this, "<html><body><div>" + "Changes will have effect after restart of the application. " + "</div><div>A restart is highly recommended due to memory usage." + "</div><div><br />Restart now?</div></body></html>", "Restart application", JOptionPane.YES_NO_OPTION); if (ret == 0) { shutdownFrame(RESTART_CODE); } } }); file.add(managePlugins); file.add(this.pnp); file.add(new FixedSeparator()); file.add(restart); file.add(new FixedSeparator()); file.add(exit); this.menu.add(file); this.inputPluginMenu = new JMenu("InputPlugins"); this.outputPluginMenu = new JMenu("OutputPlugins"); this.menu.add(this.inputPluginMenu); this.menu.add(this.outputPluginMenu); /* * help */ this.aboutDialog = new AboutDialog(SPFMainFrame.this); JMenu help = new JMenu("Help"); JMenuItem about = new JMenuItem("About"); about.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SPFMainFrame.this.aboutDialog.showSelf(SPFMainFrame.this); } }); help.add(about); this.menu.add(help); this.setJMenuBar(this.menu); /* * the tabbed pane. every tab represents a input plugin */ this.pane = new JTabbedPane(); this.pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); /* * shutdown the engine if closed */ this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { SPFMainFrame.this.shutdownFrame(); } }); /* * the framework core tab */ this.corePanel = new FrameworkCorePanel(); this.addTab(this.corePanel, "Framework Core", BLUE_IMAGE); /* * the map panel */ if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.OVERVIEW_MAP_ENABLED))) { this.mapPanel = new MapPanel(); this.addTab(this.mapPanel, "Overview Map", BLUE_IMAGE); } /* * other stuff */ this.getContentPane().add(this.pane); JPanel statusBar = new JPanel(); statusBar.setLayout(new BorderLayout()); statusBar.setPreferredSize(new Dimension(200, 25)); JPanel statusBarWrapper = new JPanel(new BorderLayout()); statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.WEST); statusBarWrapper.add(statusBar); statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.EAST); this.statusLabel = new JLabel("SPFramework startup finished."); statusBar.add(this.statusLabel, BorderLayout.EAST); this.outputLabel = new JLabel("(no output yet)"); statusBar.add(this.outputLabel, BorderLayout.WEST); this.getContentPane().add(statusBarWrapper, BorderLayout.SOUTH); this.getContentPane().setBackground(this.pane.getBackground()); this.setPreferredSize(new Dimension(1280, 720)); this.pack(); /* * full screen? */ if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.MAXIMIZED))) { this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); } this.setLocationRelativeTo(null); }
From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java
/** * UI Setup operations./* w ww. j a v a2 s.c o m*/ */ private void setupUI() { setTitle("Nebula Grid - Execution Node"); setSize(WIDTH, HEIGHT); setJMenuBar(setupMenu()); setLayout(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); add(tabs, BorderLayout.CENTER); tabs.addTab("Control Center", setupGeneral()); tabs.addTab("History", setupHistory()); resetActiveJobInfo(); setStatus("Not Connected"); updateGridInfo(); updateExecutionTime(); setupTrayIcon(this); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,/*from w w w . j ava2s . co m*/ new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
From source file:org.nuclos.client.main.mainframe.workspace.WorkspaceEditor.java
public WorkspaceEditor(WorkspaceVO wovo) { final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance(); this.wovo = wovo; this.backup = new WorkspaceVO(); this.backup.importHeader(wovo.getWoDesc()); boolean showAlwaysReset = wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN); contentPanel = new JPanel(); initJPanel(contentPanel,// w ww . j a va2 s. co m new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, 20, 20, 20, showAlwaysReset ? 20 : 0, 10, 20, TableLayout.FILL, TableLayout.PREFERRED }); contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel lbName = new JLabel(localeDelegate.getMessage("WorkspaceEditor.2", "Name"), JLabel.TRAILING); contentPanel.add(lbName, "0, 0"); tfName = new JTextField(15); lbName.setLabelFor(tfName); contentPanel.add(tfName, "1, 0"); chckHideName = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.3", "Name ausblenden")); contentPanel.add(chckHideName, "2, 0, 3, 0"); chckHide = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.8", "Auswahl Button ausblenden")); if (wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN)) { contentPanel.add(chckHide, "4, 0"); } chckAlwaysOpenAtLogin = new JCheckBox( localeDelegate.getMessage("WorkspaceEditor.11", "Immer bei Anmeldung ffnen")); contentPanel.add(chckAlwaysOpenAtLogin, "1, 1"); JLabel lbMainFrame = new JLabel(localeDelegate.getMessage("WorkspaceEditor.9", "Hauptfenster"), JLabel.TRAILING); contentPanel.add(lbMainFrame, "0, 2"); chckHideMenuBar = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.10", "Nur Standard Menuleiste")); contentPanel.add(chckHideMenuBar, "1, 2"); chckUseLastFrameSettings = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.12", "Letzte Fenster Einstellungen bernehmen (Gre und Position)")); contentPanel.add(chckUseLastFrameSettings, "1, 3, 5, 3"); chckAlwaysReset = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.alwaysreset", "Zuletzt geffnete Tabs immer zurcksetzen")); if (showAlwaysReset) { contentPanel.add(chckAlwaysReset, "1, 4, 5, 4"); } JTabbedPane tbbdPane = new JTabbedPane(); nuclosIconChooser = new ResourceIconChooser(WorkspaceChooserController.ICON_SIZE, NuclosResourceCategory.ENTITY_ICON); nuclosIconChooser.removeBorder(); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.4", "Icon"), nuclosIconChooser); JPanel parameterPanel = new JPanel(new BorderLayout()); parameterModel = new ParameterModel(); jtbParameter = new JTable(parameterModel); JScrollPane parameterScroller = new JScrollPane(jtbParameter); jtbParameter.setFillsViewportHeight(true); jtbParameter.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jtbParameter.getColumnModel().getColumn(0).setPreferredWidth(100); jtbParameter.getColumnModel().getColumn(1).setPreferredWidth(400); parameterPanel.add(parameterScroller, BorderLayout.CENTER); JToolBar parameterTools = UIUtils.createNonFloatableToolBar(JToolBar.VERTICAL); parameterTools.add(new ParameterAddButton()); btRemoveParameter = new ParameterRemoveButton(); btRemoveParameter.setEnabled(false); parameterTools.add(btRemoveParameter); parameterPanel.add(parameterTools, BorderLayout.WEST); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.13", "Parameter"), parameterPanel); contentPanel.add(tbbdPane, "1, 6, 5, 7"); JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2)); btSave = new JButton(localeDelegate.getMessage("WorkspaceEditor.5", "Speichern")); btCancel = new JButton(localeDelegate.getMessage("WorkspaceEditor.6", "Abbrechen")); actionsPanel.add(btSave); actionsPanel.add(btCancel); contentPanel.add(actionsPanel, "0, 8, 5, 8"); tfName.setText(wovo.getWoDesc().getName()); chckHide.setSelected(wovo.getWoDesc().isHide()); chckHideName.setSelected(wovo.getWoDesc().isHideName()); chckHideMenuBar.setSelected(wovo.getWoDesc().isHideMenuBar()); chckAlwaysOpenAtLogin.setSelected(wovo.getWoDesc().isAlwaysOpenAtLogin()); chckUseLastFrameSettings.setSelected(wovo.getWoDesc().isUseLastFrameSettings()); chckAlwaysReset.setSelected(wovo.getWoDesc().isAlwaysReset()); nuclosIconChooser.setSelected(wovo.getWoDesc().getNuclosResource()); parameterModel.setParamters(wovo.getWoDesc().getParameters()); dialog = new JDialog(Main.getInstance().getMainFrame(), localeDelegate.getMessage("WorkspaceEditor.1", "Arbeitsumgebung Eigenschaften"), true); dialog.setContentPane(contentPanel); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.getRootPane().setDefaultButton(btSave); Rectangle mfBounds = Main.getInstance().getMainFrame().getBounds(); dialog.setBounds(mfBounds.x + (mfBounds.width / 2) - 300, mfBounds.y + (mfBounds.height / 2) - 200, 600, 400); dialog.setResizable(false); initListener(); dialog.setVisible(true); }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JComponent createTabsPanel() { JTabbedPane tabbedPane = new JTabbedPane(); JPanel locationPanel = createLocationsPanel(); tabbedPane.addTab("Locations", null, locationPanel, "Specify the location of the source data and the working folder"); JPanel scanPanel = createScanPanel(); tabbedPane.addTab("Scan", null, scanPanel, "Create a scan of the source data"); JPanel fakeDataPanel = createFakeDataPanel(); tabbedPane.addTab("Fake data generation", null, fakeDataPanel, "Create fake data based on a scan report for development purposes"); return tabbedPane; }
From source file:org.openconcerto.erp.core.finance.accounting.element.AnalytiqueSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = 4;/*from ww w . j a v a 2 s . com*/ c.gridheight = 8; vecteurTabAxe = new Vector(); repartitionsAxe = new Vector(); repartitionElemsAxe = new Vector(); postesAxe = new Vector(); tabAxes = new JTabbedPane(); /*********************************************************************************** * * CREATION DES ONGLETS **********************************************************************************/ // on recupere les axes existant // SELECT ID, NOM FROM AXE SQLBase base = getTable().getBase(); SQLSelect sel = new SQLSelect(base); sel.addSelect(getTable().getKey()); sel.addSelect(getTable().getField("NOM")); sel.addRawOrder("AXE_ANALYTIQUE.NOM"); String req = sel.asString(); Object ob = getTable().getBase().getDataSource().execute(req, new ArrayListHandler()); List myList = (List) ob; if (myList.size() != 0) { // on cre les onglets et on stocke les axes for (int i = 0; i < myList.size(); i++) { // ID, nom Object[] objTmp = (Object[]) myList.get(i); axes.add(new Axe(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString())); // on recupere les repartitions et les lements associs l'axe RepartitionAxeAnalytiquePanel repAxeComp = new RepartitionAxeAnalytiquePanel( ((Axe) axes.get(i)).getId()); repartitionsAxe.add(repAxeComp.getRepartitions()); repartitionElemsAxe.add(repAxeComp.getRepartitionElems()); postesAxe.add(repAxeComp.getPostes()); tabAxes.addTab(((Axe) axes.get(i)).getNom(), repAxeComp); vecteurTabAxe.add(i, new String(String.valueOf(i))); } System.out.println("Size ----> " + axes.size()); } else { ajouterAxe("Nouvel Axe"); } c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; this.add(tabAxes, c); tabAxes.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent e) { final int index = tabAxes.indexAtLocation(e.getX(), e.getY()); validAxeText(); if (e.getClickCount() == 2) { actionModifierAxe(e, index); } if (e.getButton() == MouseEvent.BUTTON3) { actionDroitOnglet(index, e); } } }); tabAxes.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { validAxeText(); } public void ancestorRemoved(AncestorEvent event) { validAxeText(); } public void ancestorMoved(AncestorEvent event) { validAxeText(); } }); /*********************************************************************************** * * AJOUT D'UN AXE **********************************************************************************/ JButton boutonAddAxe = new JButton("Ajouter un axe"); boutonAddAxe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (ajoutAxeFrame == null) { ajoutAxeFrame = new AjouterAxeAnalytiqueFrame(a); } ajoutAxeFrame.pack(); ajoutAxeFrame.setVisible(true); } }); c.gridx += 4; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(boutonAddAxe, c); /*********************************************************************************** * * SUPPRESSION D'UN AXE **********************************************************************************/ JButton boutonDelAxe = new JButton("Supprimer un axe"); boutonDelAxe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { supprimerAxe(Integer.parseInt(vecteurTabAxe.get(tabAxes.getSelectedIndex()).toString())); } }); c.gridy++; this.add(boutonDelAxe, c); JButton boutonSet = new JButton("SetVal"); boutonSet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVal(); } }); c.gridy++; this.add(boutonSet, c); JButton boutonCheck = new JButton("Check"); boutonCheck.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { checkID(); } }); c.gridy++; this.add(boutonCheck, c); } }; }