javax.swing.JTabbedPane源码实例Demo

java.awt.image.ShortLookupTable#javax.swing.JTabbedPane源码实例Demo

下面列出了java.awt.image.ShortLookupTable#javax.swing.JTabbedPane 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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);
}
 
源代码2 项目: bigtable-sql   文件: UIFactory.java
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;
}
 
源代码3 项目: orbit-image-analysis   文件: OutlookBarMain.java
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);
}
 
源代码4 项目: meka   文件: MarkdownTextAreaWithPreview.java
/**
 * 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();
		}
	});
}
 
源代码5 项目: iBioSim   文件: CloseTabPaneUI.java
@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!
	}
}
 
源代码6 项目: GIFKR   文件: ChannelSettingsPanel.java
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");
}
 
源代码7 项目: netbeans   文件: CollapsiblePanel.java
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);
    }
}
 
源代码8 项目: jdk8u-jdk   文件: Test7024235.java
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;
    }
}
 
源代码9 项目: ramus   文件: Tab.java
/**
 * 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));
}
 
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);
    }
 
源代码11 项目: egdownloader   文件: TaskTagsPanel.java
@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);
}
 
源代码12 项目: Bytecoder   文件: MultiTabbedPaneUI.java
/**
 * 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;
}
 
源代码13 项目: marathonv5   文件: JTabbedPaneJavaElement.java
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;
}
 
源代码14 项目: openjdk-jdk9   文件: JTabbedPaneOperator.java
/**
 * Maps {@code JTabbedPane.getForegroundAt(int)} through queue
 */
public Color getForegroundAt(final int i) {
    return (runMapping(new MapAction<Color>("getForegroundAt") {
        @Override
        public Color map() {
            return ((JTabbedPane) getSource()).getForegroundAt(i);
        }
    }));
}
 
源代码15 项目: CQL   文件: AqlViewer.java
public static JComponent view(String k, Semantics s, int maxrows, Exp<?> exp, AqlEnv env, boolean showAtts) {
	JTabbedPane ret = new JTabbedPane();
	new AqlViewer(maxrows, env, showAtts).visit(k, ret, s);
	String l = "Compute time: " + env.performance.get(k) + " s.\n\nSize: " + s.size();
	if (s.size() < 1024) {
		ret.addTab("Text", new CodeTextPanel("", s.toString()));
	} else {
		ret.addTab("Text", new CodeTextPanel("", "Suppressed, size " + s.size() + "."));
	}
	
	ret.addTab("Expression", new CodeTextPanel("", l + "\n\n" + exp.toString()));
	// System.out.println(exp.getClass() + " " + env.performance.get(k));
	return ret;
}
 
源代码16 项目: CQL   文件: AqlViewer.java
@SuppressWarnings("hiding")
@Override
public <Ty, En, Sym, Fk, Att> Unit visit(String k, JTabbedPane ret, Schema<Ty, En, Sym, Fk, Att> S) {
	ret.addTab("Graph", viewSchema(S));
	// ret.add("Graph2", viewSchemaAlt(S));
	ret.addTab("DP", viewDP(S.dp(), x->S.collage(), S.typeSide.js));
	// ret.add(new CodeTextPanel("", schema.collage().toString()), "Temp");
	ret.add("Acyclic?", acyclicPanel(S));
	return Unit.unit;
}
 
源代码17 项目: EchoSim   文件: MainPanel.java
private void initLayout()
{
    JTabbedPane tabs = new JTabbedPane();
    tabs.add("App", mApp);
    tabs.add("Tester", mTester);
    tabs.add("Script", mAutoScript);
    tabs.add("Suite", mTestSuite);
    tabs.add("Manual", mManScript);
    tabs.add("Natural", mNatural);
    setLayout(new BorderLayout());
    add("Center", tabs);
}
 
源代码18 项目: netbeans   文件: DiffViewModeSwitcher.java
public void setupMode (DiffController view) {
    JTabbedPane tabPane = findTabbedPane(view.getJComponent());
    if (tabPane != null) {
        if (!handledViews.containsKey(tabPane)) {
            ChangeListener list = WeakListeners.change(this, tabPane);
            handledViews.put(tabPane, list);
            tabPane.addChangeListener(list);
        }
        if (tabPane.getTabCount() > diffViewMode) {
            tabPane.setSelectedIndex(diffViewMode);
        }
    }
}
 
源代码19 项目: TencentKona-8   文件: Test4234761.java
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();
}
 
源代码20 项目: attic-polygene-java   文件: GraphPane.java
public GraphPane()
{
    treeDisplay = new TreeGraphDisplay();
    stackedDisplay = new StackedGraphDisplay();

    List<GraphDisplay> tmpList = new ArrayList<>( 2 );
    tmpList.add( treeDisplay );
    tmpList.add( stackedDisplay );
    displays = Collections.unmodifiableList( tmpList );

    scrollPane = new JScrollPane();
    scrollPane.setViewportView( stackedDisplay );
    int unitInc = 50;
    scrollPane.getVerticalScrollBar().setUnitIncrement( unitInc );
    scrollPane.getHorizontalScrollBar().setUnitIncrement( unitInc );

    tabPane = new JTabbedPane();
    tabPane.add( "Tree", treeDisplay );
    tabPane.add( "Stacked", scrollPane );

    this.setLayout( new BorderLayout() );
    add( tabPane, BorderLayout.CENTER );

    treeDisplay.addLinkListener( this::graphItemLinkActivated );

    stackedDisplay.addLinkListener( this::graphItemLinkActivated );

    this.addComponentListener( new ComponentAdapter()
    {
        @Override
        public void componentResized( ComponentEvent evt )
        {
            Dimension size = GraphPane.this.getSize();
            treeDisplay.setSize( size.width, size.height );
            tabPane.revalidate();
            tabPane.repaint();
        }
    } );
}
 
源代码21 项目: openjdk-jdk9   文件: JTabbedPaneOperator.java
/**
 * Maps {@code JTabbedPane.setDisabledIconAt(int, Icon)} through queue
 */
public void setDisabledIconAt(final int i, final Icon icon) {
    runMapping(new MapVoidAction("setDisabledIconAt") {
        @Override
        public void map() {
            ((JTabbedPane) getSource()).setDisabledIconAt(i, icon);
        }
    });
}
 
源代码22 项目: tn5250j   文件: ButtonTabComponent.java
public ButtonTabComponent(final JTabbedPane pane) {
	super(new BorderLayout(0, 0));
	if (pane == null) {
		throw new NullPointerException("TabbedPane is null");
	}
	this.pane = pane;
	setOpaque(false);

	this.label = new TabLabel(); // {
	label.setHorizontalAlignment(SwingConstants.CENTER);
	label.setVerticalAlignment(SwingConstants.CENTER);
	add(label, BorderLayout.CENTER);
	// add more space between the label and the button
	label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
	// tab button
	JButton button = new TabButton();
	button.setHorizontalAlignment(SwingConstants.TRAILING);
	add(button, BorderLayout.EAST);
	// add more space to the top of the component
	setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));

	pane.addPropertyChangeListener(new PropertyChangeListener() {
		// triggers repaint, so size is recalculated, when title text changes
		@Override
		public void propertyChange(PropertyChangeEvent evt) {
			if ("indexForTitle".equals(evt.getPropertyName())) {
				label.revalidate();
				label.repaint();
			}
		}
	});
}
 
源代码23 项目: marathonv5   文件: RTabbedPaneTest.java
protected Point getTabClickPoint(final JTabbedPane tp, final int tabIndex) {
    final Point[] ps = new Point[] { null };
    siw(new Runnable() {
        @Override
        public void run() {
            Rectangle boundsAt = tp.getBoundsAt(tabIndex);
            ps[0] = new Point(boundsAt.x + boundsAt.width / 2, boundsAt.y + boundsAt.height / 2);
        }
    });
    Point p = ps[0];
    return p;
}
 
源代码24 项目: swift-k   文件: MSynthPainter.java
@Override
public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) {
    JTabbedPane t = (JTabbedPane) context.getComponent();
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    if (t.getSelectedIndex() == tabIndex) {
        g.setColor(ACCENT);
        g.fillRoundRect(x, y, w - 2, 5, 5, 5);
        g.setColor(BG);
        g.fillRect(x, y + 2, w - 2, 4);
    }
}
 
源代码25 项目: pentaho-reporting   文件: JdbcDataSourceDialog.java
private JPanel createQueryDetailsPanel() {
  final JPanel queryNamePanel = new JPanel( new BorderLayout() );
  queryNamePanel.setBorder( BorderFactory.createEmptyBorder( 8, 8, 0, 8 ) );
  queryNamePanel.add( new JLabel( Messages.getString( "JdbcDataSourceDialog.QueryStringLabel" ) ), BorderLayout.NORTH );
  queryNamePanel.add( queryNameTextField, BorderLayout.SOUTH );

  final InvokeQueryDesignerAction queryDesignerAction = new InvokeQueryDesignerAction();
  dialogModel.addPropertyChangeListener( queryDesignerAction );

  final JPanel queryButtonsPanel = new JPanel( new FlowLayout( FlowLayout.RIGHT, 5, 5 ) );
  queryButtonsPanel.add( new BorderlessButton( queryDesignerAction ) );

  final JPanel queryControlsPanel = new JPanel( new BorderLayout() );
  queryControlsPanel.add( new JLabel( Messages.getString( "JdbcDataSourceDialog.QueryDetailsLabel" ) ), BorderLayout.WEST );
  queryControlsPanel.add( queryButtonsPanel, BorderLayout.EAST );

  final JPanel queryPanel = new JPanel( new BorderLayout() );
  queryPanel.add( queryControlsPanel, BorderLayout.NORTH );
  queryPanel.add( new RTextScrollPane( 500, 300, queryTextArea, true ), BorderLayout.CENTER );
  queryPanel.setBorder( BorderFactory.createEmptyBorder( 8, 8, 0, 8 ) );

  final JTabbedPane queryScriptTabPane = new JTabbedPane();
  queryScriptTabPane.addTab( Messages.getString( "JdbcDataSourceDialog.StaticQuery" ), queryPanel );
  queryScriptTabPane.addTab( Messages.getString( "JdbcDataSourceDialog.QueryScripting" ), createQueryScriptTab() );

  // Create the query details panel
  final JPanel queryDetailsPanel = new JPanel( new BorderLayout() );
  queryDetailsPanel.add( BorderLayout.NORTH, queryNamePanel );
  queryDetailsPanel.add( BorderLayout.CENTER, queryScriptTabPane );
  return queryDetailsPanel;
}
 
源代码26 项目: marathonv5   文件: TabbedPaneDemo.java
public TabbedPaneDemo() {
    super(new GridLayout(1, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon icon = createImageIcon("images/middle.gif");

    JComponent panel1 = makeTextPanel("Panel #1");
    tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    JComponent panel2 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    JComponent panel3 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
    panel4.setPreferredSize(new Dimension(410, 50));
    tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    // Add the tabbed pane to this panel.
    add(tabbedPane);

    // The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}
 
源代码27 项目: netbeans   文件: TabDisplayerFactory.java
@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 );
}
 
源代码28 项目: jdk8u60   文件: Test4234761.java
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();
}
 
源代码29 项目: pumpernickel   文件: BoxTabbedPaneUI.java
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;
}
 
源代码30 项目: jdk8u60   文件: bug7170310.java
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);
}