javax.swing.JTabbedPane#setTabComponentAt ( )源码实例Demo

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

源代码1 项目: MeteoInfo   文件: GuiUtil.java
private static TextEditor addNewTextEditor(String title, JTabbedPane tabbedPanel) {
    final TextEditor tab = new TextEditor(tabbedPanel, title);
    tabbedPanel.add(tab, title);
    tabbedPanel.setSelectedComponent(tab);
    //tab.setTextFont(_font);
    tab.getTextArea().setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
    tab.getTextArea().discardAllEdits();
    tab.getTextArea().setDirty(false);
    tab.setTitle(title);
    ButtonTabComponent btc = new ButtonTabComponent(tabbedPanel);
    JButton button = btc.getTabButton();
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //FrmTextEditor.this.closeFile(tab);
        }
    });
    tabbedPanel.setTabComponentAt(tabbedPanel.indexOfComponent(tab), btc);

    return tab;
}
 
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);
    }
 
源代码3 项目: Course_Generator   文件: frmMain.java
/**
 * Add a tab to JTabbedPane. The icon is at the left of the text and there some
 * space between the icon and the label
 * 
 * @param tabbedPane JTabbedPane where we want to add the tab
 * @param tab        Tab to add
 * @param title      Title of the tab
 * @param icon       Icon of the tab
 */
private JLabel addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) {
	tabbedPane.add(tab);

	// Create bespoke component for rendering the tab.
	javax.swing.JLabel lbl = new javax.swing.JLabel(title);
	if (icon != null)
		lbl.setIcon(icon);

	// Add some spacing between text and icon, and position text to the RHS.
	lbl.setIconTextGap(5);
	lbl.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

	tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl);

	return lbl;
}
 
源代码4 项目: Course_Generator   文件: frmSettings.java
/**
 * Add a tab to JTabbedPane. The icon is at the left of the text and there some
 * space between the icon and the label
 * 
 * @param tabbedPane JTabbedPane where we want to add the tab
 * @param tab        Tab to add
 * @param title      Title of the tab
 * @param icon       Icon of the tab
 */
private void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) {
	tabbedPane.add(tab);

	// Create bespoke component for rendering the tab.
	javax.swing.JLabel lbl = new javax.swing.JLabel(title);
	if (icon != null)
		lbl.setIcon(icon);

	// Add some spacing between text and icon, and position text to the RHS.
	lbl.setIconTextGap(5);
	lbl.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

	tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl);
}
 
源代码5 项目: jpexs-decompiler   文件: MainPanel.java
private static void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) {
    tabbedPane.add(tab);

    JLabel lbl = new JLabel(title);
    lbl.setIcon(icon);
    lbl.setIconTextGap(5);
    lbl.setHorizontalTextPosition(SwingConstants.RIGHT);

    tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl);
}
 
源代码6 项目: wildfly-core   文件: ExploreNodeAction.java
public void actionPerformed(ActionEvent ae) {
    JTabbedPane tabs = cliGuiCtx.getTabs();
    int newTabIndex = tabs.getSelectedIndex() + 1;
    ManagementModelNode newRoot = node.clone();
    tabs.insertTab(calcTabName(this.node), null, new ManagementModel(newRoot, cliGuiCtx), newRoot.addressPath(), newTabIndex);
    tabs.setTabComponentAt(newTabIndex, new ButtonTabComponent(tabs));
    tabs.setSelectedIndex(newTabIndex);
}
 
private void addTab(JTabbedPane tabControl, String title, JPanel content) {
    JLabel tabText = new JLabel(title, JLabel.LEFT);
    tabText.setPreferredSize(new Dimension(6 * controlHeight, controlHeight));
    TitledBorder titledBorder = BorderFactory.createTitledBorder(title);
    titledBorder.setTitleJustification(TitledBorder.CENTER);
    content.setBorder(titledBorder);
    tabControl.addTab(null, content);
    tabControl.setTabComponentAt(tabControl.getTabCount() - 1, tabText);
}
 
源代码8 项目: AML-Project   文件: ViewMapping.java
private void refresh()
{
	a = aml.getAlignment();
	mapping = aml.getActiveMapping();
       m = a.get(mapping);
       sourceId = m.getSourceId();
       targetId = m.getTargetId();
       t = uris.getType(sourceId);
       
       //Set the title and modality
       this.setTitle(m.toGUI());
	this.setModalityType(ModalityType.APPLICATION_MODAL);

       //Setup the Tabbed Pane
       tabbedPane = new JTabbedPane();
       tabbedPane.setBackground(AMLColor.WHITE);

       //Add the graph
       buildGraph();
       if(mappingViewer != null)
       {
       	tabbedPane.addTab("Graph View", mappingViewer);
       	mappingViewer.mouseClicked();
       }
       else
       	tabbedPane.addTab("Graph View", new JPanel());
       JLabel lab1 = new JLabel("Graph View",SwingConstants.CENTER);
       lab1.setPreferredSize(new Dimension(120, 15));
       tabbedPane.setTabComponentAt(0, lab1);
       //Add the details
       buildDetailPanel();
       tabbedPane.addTab("Details", details);
       JLabel lab2 = new JLabel("Details",SwingConstants.CENTER);
       lab2.setPreferredSize(new Dimension(120, 15));
       tabbedPane.setTabComponentAt(1, lab2);
       //Add the issues
       buildConflictPanel();
       tabbedPane.addTab("Status & Conflicts", conflicts);
       JLabel lab3 = new JLabel("Status & Conflicts",SwingConstants.CENTER);
       lab3.setPreferredSize(new Dimension(120, 15));
       tabbedPane.setTabComponentAt(2, lab3);
       
       //Set the tabbed pane as the content pane
	setContentPane(tabbedPane);
	
	//Wrap up
	this.pack();
	GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
	int left = g.getCenterPoint().x - (int)(this.getPreferredSize().width / 2);
	this.setLocation(left, 0);
       this.setVisible(true);
}