本文整理匯總了Java中javax.swing.JTabbedPane.addTab方法的典型用法代碼示例。如果您正苦於以下問題:Java JTabbedPane.addTab方法的具體用法?Java JTabbedPane.addTab怎麽用?Java JTabbedPane.addTab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.addTab方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DFDObjectDialog
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public DFDObjectDialog(GUIFramework framework, DataPlugin dataPlugin) {
super(framework.getMainFrame(), true);
setTitle("dfd_object_options");
this.dataPlugin = dataPlugin;
this.framework = framework;
JTabbedPane pane = new JTabbedPane();
pane.addTab(ResourceLoader.getString("dfd_object"), createFirstTab(pane));
pane.addTab(ResourceLoader.getString("font"), fontChooser);
pane.addTab(ResourceLoader.getString("bk_color"),
backgroundColorChooser);
pane.addTab(ResourceLoader.getString("fg_color"),
foregroundColorChooser);
setMainPane(pane);
ResourceLoader.setJComponentsText(this);
this.pack();
this.setMinimumSize(getSize());
centerDialog();
Options.loadOptions(this);
}
示例2: constructAdvancedPanel
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void constructAdvancedPanel(JTabbedPane tabbedPane) {
PropertiesPanel panel = new PropertiesPanel(parent);
tabbedPane.addTab("Advanced", null, panel, null);
GridBagLayout gbl_advpanel = new GridBagLayout();
gbl_advpanel.columnWidths = new int[]{200, 300, 30, 80, 0};
gbl_advpanel.columnWeights = new double[]{0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
gbl_advpanel.rowHeights = new int[]{15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0};
gbl_advpanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
panel.setLayout(gbl_advpanel);
panel.addComboBoxEntry(1, EnumParam.optimizer, "Optimizer", DrivestrengthParameters.OPTIMIZERS);
panel.addSliderEntry(2, IntParam.optimizeEnergyPercentage, "Energy weight in SA-Optimizer", 0, 100, 0);
panel.addSpinnerEntry(3, DoubleParam.outputPinCapacitance, "Output pin load capacitance (picofarad)", 0.01, 0.012);
panel.addSpinnerEntry(4, DoubleParam.inputDrivenMaxCIn, "Capacitance limit for input-driven cells (picofarad)", 0.01, 0.005);
getDataFromPanel(panel);
}
示例3: createTabbedPane
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private static JTabbedPane createTabbedPane(JPanel basePanel, JPanel adminPanel) {
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab(
getMessage("PropertiesDialog.BasePanelTitle"),
/* icon */ null, basePanel,
getMessage("PropertiesDialog.BasePanelHint"));
tabbedPane.addTab(
getMessage("PropertiesDialog.AdminPanelTitle"),
/* icon */ null, adminPanel,
getMessage("PropertiesDialog.AdminPanelHint"));
tabbedPane.getAccessibleContext().setAccessibleName(
getMessage("PropertiesDialog.ACS_Name"));
tabbedPane.getAccessibleContext().setAccessibleDescription(
getMessage("PropertiesDialog.ACS_Desc"));
return tabbedPane;
}
示例4: test
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private static void test() {
int N = 5;
JTabbedPane tabbedPane = new JTabbedPane();
for (int i = 0; i < N; i++) {
tabbedPane.addTab("Title: " + i, new JLabel("Component: " + i));
}
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
Component child = tabbedPane.getComponentAt(i);
AccessibleContext ac = child.getAccessibleContext();
if (ac == null) {
throw new RuntimeException("Accessible Context is null!");
}
int index = ac.getAccessibleIndexInParent();
Accessible parent = ac.getAccessibleParent();
if (parent.getAccessibleContext().getAccessibleChild(index) != child) {
throw new RuntimeException("Wrong getAccessibleIndexInParent!");
}
}
}
示例5: init
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void init() {
facade = new GUIFacade();
setLayout(new BorderLayout());
tabbedPane = new JTabbedPane();
tabbedPane.addTab("Creation", new CreationPanel(facade));
tabbedPane.addTab("Ants", new AntsPanel(facade));
tabbedPane.addTab("Foods", new FoodsPanel(facade));
tabbedPane.addTab("Ant-Food", new AntFoodsPanel(facade));
tabbedPane.addTab("Hills", new HillsPanel(facade));
add(tabbedPane, BorderLayout.CENTER);
pack();
setSize(400, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
示例6: GysGuanLi
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public GysGuanLi() {
setIconifiable(true);
setClosable(true);
setTitle("��Ӧ�̹���");
JTabbedPane tabPane = new JTabbedPane();
final GysXiuGaiPanel spxgPanel = new GysXiuGaiPanel();
final GysTianJiaPanel sptjPanel = new GysTianJiaPanel();
tabPane.addTab("��Ӧ����Ϣ���", null, sptjPanel, "��Ӧ�����");
tabPane.addTab("��Ӧ����Ϣ����ɾ��", null, spxgPanel, "����ɾ��");
getContentPane().add(tabPane);
tabPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
spxgPanel.initComboBox();
}
});
pack();
setVisible(true);
}
示例7: initSidePane
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void initSidePane() {
sidePane = new JTabbedPane(JTabbedPane.TOP);
centerPane.setLeftComponent(sidePane);
sidePane.setMinimumSize(new Dimension(180, 0));
projectPanel = new JPanel();
sidePane.addTab("Project", null, projectPanel, null);
projectPanel.setLayout(new BorderLayout(0, 0));
projectScrollPane = new JScrollPane();
projectPanel.add(projectScrollPane, BorderLayout.CENTER);
repositoryPanel = new JPanel();
sidePane.addTab("Repository", null, repositoryPanel, null);
repositoryPanel.setLayout(new BorderLayout(0, 0));
repositoryScrollPane = new JScrollPane();
repositoryPanel.add(repositoryScrollPane, BorderLayout.CENTER);
}
示例8: createRightPane
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
@Override
protected JComponent createRightPane() {
JTabbedPane tabs = new JTabbedPane();
tabs.addTab("One", new SelectionPanel(graphpanel));
tabs.addTab("Two", new JLabel("Two"));
tabs.addTab("Three", new JLabel("Three"));
tabs.setPreferredSize(new Dimension(80, 300));
return tabs;
}
示例9: addProjectTabInternal
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/**
* Adds a Project-Tab and a new node (child of a specified parent) to the ProjectWindow.
*
* @param projectWindowTab the project window tab
* @return the default mutable tree node
*/
private DefaultMutableTreeNode addProjectTabInternal(ProjectWindowTab projectWindowTab) {
// --- create Node ----------------------
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(projectWindowTab);
DefaultMutableTreeNode pareNode = null;
JTabbedPane tabbedPaneParent = null;
String parentName = projectWindowTab.getParentName();
// --- add to the TreeModel -------------
if (parentName != null) {
pareNode = getTreeNode(parentName);
ProjectWindowTab pareNodePWT = (ProjectWindowTab) pareNode.getUserObject();
tabbedPaneParent = pareNodePWT.getCompForChildComp();
// --- add ChangeListener -----------
this.addChangeListener(tabbedPaneParent);
} else {
pareNode = this.getRootNode();
tabbedPaneParent = projectViewRightTabs;
}
if (projectWindowTab.getIndexPosition() != -1 && projectWindowTab.getIndexPosition() < pareNode.getChildCount()) {
// --- Add to parent node/tab at index position ----
pareNode.insert(newNode, projectWindowTab.getIndexPosition());
tabbedPaneParent.insertTab(projectWindowTab.getTitle(), projectWindowTab.getIcon(), projectWindowTab.getJComponentForVisualization(), projectWindowTab.getTipText(), projectWindowTab.getIndexPosition());
} else {
// --- Just add to parent node/tab -----------------
pareNode.add(newNode);
tabbedPaneParent.addTab(projectWindowTab.getTitle(), projectWindowTab.getIcon(), projectWindowTab.getJComponentForVisualization(), projectWindowTab.getTipText());
}
// --- refresh view ---------------------
this.getTreeModel().reload();
this.projectTreeExpand2Level(3, true);
return newNode;
}
示例10: createSyntaxHelp
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/** Creates and returns a panel for the syntax descriptions. */
private JComponent createSyntaxHelp() {
initSyntax();
final JTabbedPane tabbedPane = new JTabbedPane();
final int nodeTabIndex = tabbedPane.getTabCount();
tabbedPane.addTab("Nodes",
null,
createSyntaxList(this.nodeKeys),
"Label prefixes that are allowed on nodes");
final int edgeTabIndex = tabbedPane.getTabCount();
tabbedPane.addTab("Edges",
null,
createSyntaxList(this.edgeKeys),
"Label prefixes that are allowed on edges");
if (this.role == GraphRole.RULE) {
tabbedPane.addTab("RegExpr", null, createSyntaxList(RegExpr.getDocMap()
.keySet()), "Syntax for regular expressions over labels");
tabbedPane.addTab("Expr", null, createSyntaxList(Algebras.getDocMap()
.keySet()), "Available attribute operators");
}
JPanel result = new TitledPanel("Label syntax help", tabbedPane, null, false);
// add a listener that switches the syntax help between nodes and edges
// when a cell edit is started in the JGraph
getJGraph().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == JGraph.CELL_EDIT_PROPERTY) {
int index =
evt.getNewValue() instanceof AspectJEdge ? edgeTabIndex : nodeTabIndex;
tabbedPane.setSelectedIndex(index);
}
}
});
return result;
}
示例11: buildControlPanel
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/** @return a new panel for controlling this bias generator functionally
*/
@Override
public JPanel buildControlPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JTabbedPane pane = new JTabbedPane();
pane.addTab("Biases", super.buildControlPanel());
pane.addTab("User friendly controls", new Tmpdiff128FunctionalBiasgenPanel(Tmpdiff128.this));
panel.add(pane, BorderLayout.CENTER);
return panel;
}
示例12: addTabPane
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/**
* Creates a new tabbed pane that shows specified measures and adds it to
* specified JTabPane. If measures indexes vector is null or empty no panel is added.
* @param parent panel where newly created tab should be added
* @param name name of the panel to be added
* @param description description to be shown into the panel
* @param indexes array with all measures indexes to be shown in this panel
*/
private void addTabPane(JTabbedPane parent, String name, String description, int[] indexes) {
// If no measure are present, don't add corresponding tab
if (indexes != null && indexes.length > 0) {
JPanel tabPanel = new JPanel(new BorderLayout());
// Adds margins
tabPanel.add(Box.createVerticalStrut(BORDERSIZE), BorderLayout.NORTH);
tabPanel.add(Box.createVerticalStrut(BORDERSIZE), BorderLayout.SOUTH);
tabPanel.add(Box.createHorizontalStrut(BORDERSIZE), BorderLayout.WEST);
tabPanel.add(Box.createHorizontalStrut(BORDERSIZE), BorderLayout.EAST);
JPanel mainpanel = new JPanel(new BorderLayout());
tabPanel.add(mainpanel, BorderLayout.CENTER);
// Adds tab description
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel descrLabel = new JLabel(description);
upperPanel.add(descrLabel, BorderLayout.NORTH);
upperPanel.add(Box.createVerticalStrut(BORDERSIZE / 2), BorderLayout.SOUTH);
mainpanel.add(upperPanel, BorderLayout.NORTH);
// Adds panel with measures
JPanel scroll = new JPanel(new GridLayout(indexes.length, 1, 1, 1));
// Adds all measures to this panel
for (int indexe : indexes) {
scroll.add(new PAMeasurePanel(results, indexe));//,thisMeasureValues));
}
mainpanel.add(new JScrollPane(scroll), BorderLayout.CENTER);
// Adds tab to parent tabbed pane
parent.addTab(name, tabPanel);
}
}
示例13: createAndShowUI
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
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);
}
示例14: JTabbedPaneFrame
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public JTabbedPaneFrame()
{
super("JTabbedPane Demo ");
JTabbedPane tabbedPane = new JTabbedPane(); // create JTabbedPane
// set up pane11 and add it to JTabbedPane
JLabel label1 = new JLabel("panel one", SwingConstants.CENTER);
JPanel panel1 = new JPanel();
panel1.add(label1);
tabbedPane.addTab("Tab One", null, panel1, "First Panel");
// set up panel2 and add it to JTabbedPane
JLabel label2 = new JLabel("panel two", SwingConstants.CENTER);
JPanel panel2 = new JPanel();
panel2.setBackground(Color.YELLOW);
panel2.add(label2);
tabbedPane.addTab("Tab Two", null, panel2, "Second Panel");
// set up panel3 and add it to JTabbedPane
JLabel label3 = new JLabel("panel three");
JPanel panel3 = new JPanel();
panel3.setLayout(new BorderLayout());
panel3.add(new JButton("North"), BorderLayout.NORTH);
panel3.add(new JButton("West"), BorderLayout.WEST);
panel3.add(new JButton("East"), BorderLayout.EAST);
panel3.add(new JButton("South"), BorderLayout.SOUTH);
panel3.add(label3, BorderLayout.CENTER);
tabbedPane.addTab("Tab Three", null, panel3, "Third Panel");
add(tabbedPane); // add JTabbedPane to frame
}
示例15: JTabbedPaneDemo
import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public JTabbedPaneDemo() {
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
// panel=new Panel();
// panel.setBackground(Color.RED);
// music=new JPanel();
// music.setBackground(Color.green);
tabbedPane.addTab("panel", new JLabel("標簽"));
tabbedPane.addTab("music", new Button("按鈕"));
add(tabbedPane);
setBounds(500, 100, 500, 500);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}