javax.swing.JTabbedPane Java Examples
The following examples show how to use
javax.swing.JTabbedPane.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskTagsPanel.java From egdownloader with GNU General Public License v2.0 | 6 votes |
@Override public void setViewportView(Component view) { if(view == textPane){ if(this.getParent() instanceof JTabbedPane){ if(showMyFav){ mainWindow.infoTabbedPane.setTitleAt(mainWindow.infoTabbedPane.indexOfComponent(this), "<html><font color='red'>我收藏的标签</a></html>"); }else{ mainWindow.infoTabbedPane.setTitleAt(mainWindow.infoTabbedPane.indexOfComponent(this), "标签组"); } } }else if(view == confirmPanel){ if(this.getParent() instanceof JTabbedPane){ mainWindow.infoTabbedPane.setTitleAt(mainWindow.infoTabbedPane.indexOfComponent(this), "标签操作"); } } super.setViewportView(view); }
Example #2
Source File: CycleEdit.java From android-ConstraintLayoutExamples with Apache License 2.0 | 6 votes |
void updateTabName(String name) { if (DEBUG) { System.out.println(">>>>>" + name + " " + MainPanel.getTabbIndex(this)); StackTraceElement[] s = new Throwable().getStackTrace(); System.out.println(" .(" + s[1].getFileName() + ":" + s[1].getLineNumber() + ") "); System.out.println(" .(" + s[2].getFileName() + ":" + s[2].getLineNumber() + ") "); } Container tabb = getParent(); while (!(tabb instanceof JTabbedPane)) { tabb = tabb.getParent(); } JTabbedPane tabbedPane = (JTabbedPane) tabb; int index = MainPanel.getTabbIndex(this); tabbedPane.setTitleAt(index, name); // tabUI = new TabUI(name); // tabbedPane.setTabComponentAt(index, tabUI); }
Example #3
Source File: CollapsiblePanel.java From netbeans with Apache License 2.0 | 6 votes |
public HookPanel(VCSCommitPanel master, Collection<? extends VCSHook> hooks, VCSHookContext hookContext) { super(master, (hooks.size() == 1) ? hooks.iterator().next().getDisplayName() : getMessage("LBL_Advanced"), //NOI18N DEFAULT_DISPLAY_HOOKS); this.hooks = hooks; this.hookContext = hookContext; // need this to happen in addNotify() - depends on how // repositoryComboSupport in hook.createComponents works for bugzilla|jira if (hooks.size() == 1) { JPanel p = hooks.iterator().next().createComponent(hookContext); if (Boolean.TRUE.equals(p.getClientProperty("prop.requestOpened"))) { //NOI18N - some hook panels may want to be opened (hg queue hook with previously configured setts) super.displaySection(); } sectionPanel.add(p); } else { JTabbedPane hooksTabbedPane = new JTabbedPane(); for (VCSHook hook : hooks) { hooksTabbedPane.add(hook.createComponent(hookContext), hook.getDisplayName().replaceAll("\\&", "")); } sectionPanel.add(hooksTabbedPane); } }
Example #4
Source File: UIFactory.java From bigtable-sql with Apache License 2.0 | 6 votes |
public JTabbedPane createTabbedPane(int tabPlacement, boolean dndTabbedPane) { JTabbedPane pnl; if (dndTabbedPane) { pnl = new DnDSquirrelTabbedPane(_prefs, _app); } else { pnl = new SquirrelTabbedPane(_prefs, _app); } pnl.setTabPlacement(tabPlacement); fireTabbedPaneCreated(pnl); return pnl; }
Example #5
Source File: OutlookBarMain.java From orbit-image-analysis with GNU General Public License v3.0 | 6 votes |
public OutlookBarMain() throws Exception { setLayout(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); { // the metal look and feel UIManager .setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class); tabs.addTab("Metal L&F", makeOutlookPanel(SwingConstants.CENTER)); } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); { // the windows look and feel LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class); tabs.addTab("Windows L&F", makeOutlookPanel(SwingConstants.LEFT)); } add("Center", tabs); }
Example #6
Source File: MarkdownTextAreaWithPreview.java From meka with GNU General Public License v3.0 | 6 votes |
/** * Initializes the widgets. */ @Override protected void initGUI() { super.initGUI(); setLayout(new BorderLayout()); m_TabbedPane = new JTabbedPane(); add(m_TabbedPane, BorderLayout.CENTER); m_TextCode = new JTextArea(); m_TextCode.setFont(GUIHelper.getMonospacedFont()); m_TabbedPane.addTab("Write", new BaseScrollPane(m_TextCode)); m_PanePreview = new JEditorPane(); m_PanePreview.setEditable(false); m_PanePreview.setContentType("text/html"); m_TabbedPane.addTab("Preview", new BaseScrollPane(m_PanePreview)); m_TabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { update(); } }); }
Example #7
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 6 votes |
@Override public void componentAdded(ContainerEvent e) { JTabbedPane tp = (JTabbedPane) e.getContainer(); Component child = e.getChild(); if (child instanceof UIResource) { return; } int index = tp.indexOfComponent(child); String title = tp.getTitleAt(index); boolean isHTML = BasicHTML.isHTMLString(title); if (isHTML) { if (htmlViews == null) { // Initialize vector htmlViews = createHTMLVector(); } else { // Vector already exists View v = BasicHTML.createHTMLView(tp, title); htmlViews.insertElementAt(v, index); } } else { // Not HTML if (htmlViews != null) { // Add placeholder htmlViews.insertElementAt(null, index); } // else nada! } }
Example #8
Source File: ChannelSettingsPanel.java From GIFKR with GNU Lesser General Public License v3.0 | 6 votes |
public void initializeComponents() { channelBox = new JCheckBox("Filter by channel", false); allSets = new SettingsPanel(r); rSets = new SettingsPanel(r); gSets = new SettingsPanel(r); bSets = new SettingsPanel(r); channelPane = new JTabbedPane(); channelPane.add("Red", rSets); channelPane.add("Green", gSets); channelPane.addTab("Blue", bSets); cardPanel = new JPanel(new CardLayout()); cardPanel.add(allSets, "all"); cardPanel.add(channelPane, "rgb"); }
Example #9
Source File: Test7024235.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void run() { if (this.pane == null) { this.pane = new JTabbedPane(); this.pane.addTab("1", new Container()); this.pane.addTab("2", new JButton()); this.pane.addTab("3", new JCheckBox()); JFrame frame = new JFrame(); frame.add(BorderLayout.WEST, this.pane); frame.pack(); frame.setVisible(true); test("first"); } else { test("second"); if (this.passed || AUTO) { // do not close a frame for manual review SwingUtilities.getWindowAncestor(this.pane).dispose(); } this.pane = null; } }
Example #10
Source File: Tab.java From ramus with GNU General Public License v3.0 | 6 votes |
/** * This is the default constructor */ public Tab(final Function function, final JTabbedPane pane) { super(); this.pane = pane; panel = new JPanel(new BorderLayout()); // this.setLayout(new BorderLayout()); setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); setOpaque(false); label = new JLabel(); setFunction(function); this.add(label); this.add(getJButton()); // this.add(getJLabel(), BorderLayout.CENTER); // this.add(getJButton(), BorderLayout.EAST); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); // setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example #11
Source File: TracerSimpleReportFrame.java From pega-tracerviewer with Apache License 2.0 | 6 votes |
private void addTab(String tabText, JPanel panel, int tabIndex) { JTabbedPane tracerReportTabbedPane = getTracerReportTabbedPane(); JLabel tabLabel = new JLabel(tabText); Font labelFont = tabLabel.getFont(); Font tabFont = labelFont.deriveFont(Font.BOLD, 12); Dimension dim = new Dimension(140, 26); tabLabel.setFont(tabFont); tabLabel.setSize(dim); tabLabel.setPreferredSize(dim); tabLabel.setHorizontalAlignment(SwingConstants.CENTER); tracerReportTabbedPane.addTab(tabText, panel); tracerReportTabbedPane.setTabComponentAt(tabIndex, tabLabel); }
Example #12
Source File: IntervalManagerDialog.java From nmonvisualizer with Apache License 2.0 | 5 votes |
@Override public void stateChanged(ChangeEvent e) { BaseIntervalPanel previous = null; if (absolute.isEnabled()) { previous = absolute; } else if (relative.isEnabled()) { previous = relative; } else if (bulk.isEnabled()) { previous = bulk; } else { return; } JTabbedPane tabs = (JTabbedPane) e.getSource(); BaseIntervalPanel current = (BaseIntervalPanel) tabs.getSelectedComponent(); if (current != null) { current.setIntervalName(previous.getIntervalName()); current.setTimes(previous.getStartTime(), previous.getEndTime()); current.setEnabled(true); } // remove listeners previous.setEnabled(false); current.propertyChange(new PropertyChangeEvent(this, "timeZone", null, previous.getTimeZone())); }
Example #13
Source File: GraphVisualizer.java From osmo with GNU Lesser General Public License v2.1 | 5 votes |
public GraphVisualizer(String title) { super(title); tabbedPane = new JTabbedPane(); getContentPane().add(tabbedPane); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(1024, 768); setVisible(true); }
Example #14
Source File: MultiTabbedPaneUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int tabForCoordinate(JTabbedPane a, int b, int c) { int returnValue = ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c); for (int i = 1; i < uis.size(); i++) { ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c); } return returnValue; }
Example #15
Source File: MultiTabbedPaneUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getTabBounds</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Rectangle getTabBounds(JTabbedPane a, int b) { Rectangle returnValue = ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b); for (int i = 1; i < uis.size(); i++) { ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b); } return returnValue; }
Example #16
Source File: JTabbedPaneTabJavaElement.java From marathonv5 with Apache License 2.0 | 5 votes |
private static String getTabNameFromIcon(JTabbedPane tp, int index) { Icon iconAt = tp.getIconAt(index); if (iconAt == null || !(iconAt instanceof ImageIcon) || ((ImageIcon) iconAt).getDescription() == null) { return "tabIndex-" + index; } String description = ((ImageIcon) iconAt).getDescription(); return nameFromImageDescription(description); }
Example #17
Source File: MainMenu.java From COMP6237 with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Construct the UI */ public MainMenu() { final List<LectureObject> lectures = getLectures(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); tabs = new JTabbedPane(); final List<JButton> runBtns = new ArrayList<JButton>(); for (final LectureObject l : lectures) { final Component lp = createLecturePanel(l, runBtns); tabs.addTab(l.lecture.title(), lp); } tabs.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { final int idx = tabs.getSelectedIndex(); final JRootPane root = MainMenu.this.getRootPane(); if (root != null && idx >= 0) root.setDefaultButton(runBtns.get(idx)); } }); add(tabs); final JPanel info = new JPanel(new GridLayout(0, 1)); info.setPreferredSize(new Dimension(800, 30)); info.setSize(info.getPreferredSize()); info.setMaximumSize(info.getPreferredSize()); final JLabel link = Utils.linkify("http://comp6237.ecs.soton.ac.uk", "http://comp6237.ecs.soton.ac.uk", "Go to the course web site"); link.setHorizontalAlignment(SwingConstants.CENTER); info.add(link); add(info); }
Example #18
Source File: IDEFPanel.java From ramus with GNU General Public License v3.0 | 5 votes |
/** * This method initializes this * * @return void */ private void initialize() { setLayout(new BorderLayout()); this.setSize(583, 272); getMovingArea(); this.add(getJScrollPane1(), BorderLayout.CENTER); this.add(getJPanel(), BorderLayout.NORTH); findPanel.setVisible(false); this.add(findPanel, BorderLayout.SOUTH); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { int i = tabbedPane.indexOfComponent(getJScrollPane1()); if (i >= 0) tabbedPane.setComponentAt(i, new JLabel()); i = tabbedPane.getSelectedIndex(); if (i < 0) activeTab = null; else if (i < tabbedPane.getTabCount()) { final Tab tab = (Tab) tabbedPane.getTabComponentAt(i); activeTab = tab; if (tab != null) { getMovingArea().setActiveFunction(tab.getFunction()); tab.getPanel().add(getJScrollPane1(), BorderLayout.CENTER); } } } }); }
Example #19
Source File: bug7170310.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void createAndShowUI() { frame = new JFrame("bug7170310"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Main Tab", new JPanel()); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); frame.getContentPane().add(tabbedPane); frame.setVisible(true); }
Example #20
Source File: Test4234761.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(COLOR); JDialog dialog = Test4177735.show(chooser); PropertyChangeListener listener = new Test4234761(); chooser.addPropertyChangeListener("color", listener); // NON-NLS: property name JTabbedPane tabbedPane = (JTabbedPane) chooser.getComponent(0); tabbedPane.setSelectedIndex(1); // HSB tab index if (!chooser.getColor().equals(COLOR)) { listener.propertyChange(null); } dialog.dispose(); }
Example #21
Source File: bug7170310.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void createAndShowUI() { frame = new JFrame("bug7170310"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Main Tab", new JPanel()); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); frame.getContentPane().add(tabbedPane); frame.setVisible(true); }
Example #22
Source File: bug7170310.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void createAndShowUI() { frame = new JFrame("bug7170310"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Main Tab", new JPanel()); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); frame.getContentPane().add(tabbedPane); frame.setVisible(true); }
Example #23
Source File: MultiTabbedPaneUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int tabForCoordinate(JTabbedPane a, int b, int c) { int returnValue = ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c); for (int i = 1; i < uis.size(); i++) { ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c); } return returnValue; }
Example #24
Source File: InnerTabsPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void fireChanged() { boolean isChanged = false; if (checkShowFolderName.isSelected() != settings.isShowFolderName() || checkShowFullPath.isSelected() != settings.isShowFullPath() || checkProjectColors.isSelected() != settings.isSameProjectSameColor() || checkSortDocumentList.isSelected() != settings.isSortDocumentListByProject()) { isChanged = true; } int rowCount = settings.getRowCount(); if (checkMultiRow.isSelected() && radioRowCount.isSelected()) { rowCount = ((Number) spinRowCount.getValue()).intValue(); } if (checkMultiRow.isSelected() != (rowCount > 1 || settings.isTabRowPerProject())) { isChanged = true; } if (rowCount != settings.getRowCount()) { isChanged = true; } if (radioRowPerProject.isSelected() != settings.isTabRowPerProject()) { isChanged = true; } if(radioPlacementBottom.isSelected() && settings.getTabsLocation() != JTabbedPane.BOTTOM || radioPlacementLeft.isSelected() && settings.getTabsLocation() != JTabbedPane.LEFT || radioPlacementRight.isSelected() && settings.getTabsLocation() != JTabbedPane.RIGHT || radioPlacementTop.isSelected() && settings.getTabsLocation() != JTabbedPane.TOP) { isChanged = true; } controller.changed(null, isChanged); }
Example #25
Source File: bug7170310.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void createAndShowUI() { frame = new JFrame("bug7170310"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Main Tab", new JPanel()); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); frame.getContentPane().add(tabbedPane); frame.setVisible(true); }
Example #26
Source File: JTabbedPaneJavaElement.java From marathonv5 with Apache License 2.0 | 5 votes |
private int findTabIndex(JTabbedPane tp, String tab) { int tabCount = tp.getTabCount(); int tabIndex = -1; for (int index = 0; index < tabCount; index++) { String current = JTabbedPaneTabJavaElement.getText(tp, index); if (tab.equals(current)) { tabIndex = index; break; } } return tabIndex; }
Example #27
Source File: BoxTabbedPaneUI.java From pumpernickel with MIT License | 5 votes |
protected Data getData(JTabbedPane tabs) { Data d = (Data) tabs.getClientProperty(PROPERTY_DATA); if (d == null) { d = new Data(tabs); tabs.putClientProperty(PROPERTY_DATA, d); } return d; }
Example #28
Source File: Test4234761.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(COLOR); JDialog dialog = Test4177735.show(chooser); PropertyChangeListener listener = new Test4234761(); chooser.addPropertyChangeListener("color", listener); // NON-NLS: property name JTabbedPane tabbedPane = (JTabbedPane) chooser.getComponent(0); tabbedPane.setSelectedIndex(1); // HSB tab index if (!chooser.getColor().equals(COLOR)) { listener.propertyChange(null); } dialog.dispose(); }
Example #29
Source File: TabDisplayerFactory.java From netbeans with Apache License 2.0 | 5 votes |
@Override public TabDisplayer createTabDisplayer( TabDataModel tabModel, int orientation ) { Settings settings = Settings.getDefault(); boolean multiRow = settings.getRowCount() > 1 || settings.isTabRowPerProject(); if( multiRow && (orientation == JTabbedPane.TOP || orientation == JTabbedPane.BOTTOM) ) { if( settings.isTabRowPerProject() ) { return new RowPerProjectTabDisplayer( tabModel, orientation ); } return new MultiRowTabDisplayer( tabModel, orientation ); } return new SimpleTabDisplayer( tabModel, orientation ); }
Example #30
Source File: MultiTabbedPaneUI.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int tabForCoordinate(JTabbedPane a, int b, int c) { int returnValue = ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c); for (int i = 1; i < uis.size(); i++) { ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c); } return returnValue; }