下面列出了javax.swing.JTabbedPane#insertTab ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
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 init() {
setLayout(new GridBagLayout());
workspace = new JXTextField();
workspace.setPromptForeground(Color.LIGHT_GRAY);
workspace.setFocusBehavior(FocusBehavior.SHOW_PROMPT);
datePicker = new DatePicker();
workspaceLabel = new JLabel();
timestampLabel = new JLabel();
add(workspaceLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.BOTH,0,0,5,5));
add(workspace, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
add(timestampLabel, GuiUtil.setConstraints(2,0,0.0,0.0,GridBagConstraints.NONE,0,10,5,5));
add(datePicker, GuiUtil.setConstraints(3,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,0));
operationsTab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
add(operationsTab, GuiUtil.setConstraints(0,2,4,1,1.0,1.0,GridBagConstraints.BOTH,5,0,0,0));
operations = new DatabaseOperationView[]{
new ReportOperation(this),
new BoundingBoxOperation(this, config),
new IndexOperation(this, config),
new SrsOperation(this, config),
new ADEInfoOperation(this)
};
for (int i = 0; i < operations.length; ++i)
operationsTab.insertTab(null, operations[i].getIcon(), null, operations[i].getToolTip(), i);
operationsTab.addChangeListener(e -> {
int index = operationsTab.getSelectedIndex();
for (int i = 0; i < operationsTab.getTabCount(); i++)
operationsTab.setComponentAt(i, index == i ? operations[index].getViewComponent() : null);
});
PopupMenuDecorator.getInstance().decorate(workspace, datePicker.getEditor());
}
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
/**
* Creates a tabbed pane for editing the plot attributes.
*
* @param plot the plot.
*
* @return A tabbed pane.
*/
@Override
protected JTabbedPane createPlotTabs(Plot plot) {
JTabbedPane tabs = super.createPlotTabs(plot);
// TODO find a better localization key
tabs.insertTab(localizationResources.getString("General1"), null,
createPlotPanel(), null, 0);
tabs.setSelectedIndex(0);
return tabs;
}
private TestDataTablePanel addToLastTab(JTabbedPane testdataTab, AbstractDataModel std) {
TestDataTablePanel tdPanel = new TestDataTablePanel(std);
testdataTab.insertTab(std.getName(), null, tdPanel, null, testdataTab.getTabCount() - 1);
testdataTab.setSelectedIndex(testdataTab.getTabCount() - 2);
return tdPanel;
}