下面列出了javax.swing.JTabbedPane#add ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates a tabbed pane containing an about panel and a system properties
* panel.
*
* @param info project information.
*
* @return a tabbed pane.
*/
private JTabbedPane createTabs(final ProjectInfo info) {
final JTabbedPane tabs = new JTabbedPane();
final JPanel aboutPanel = createAboutPanel(info);
aboutPanel.setBorder(AboutDialog.STANDARD_BORDER);
final String aboutTab = this.resources.getString(
"about-frame.tab.about");
tabs.add(aboutTab, aboutPanel);
final JPanel systemPanel = new SystemPropertiesPanel();
systemPanel.setBorder(AboutDialog.STANDARD_BORDER);
final String systemTab = this.resources.getString(
"about-frame.tab.system");
tabs.add(systemTab, systemPanel);
return tabs;
}
private void createTabbedPane()
{
tabs = new JTabbedPane();
tabs.setBounds(5, 5, 580, 300);
tabs.add("Mode", new ModePanel(controller));
tabs.add("Externals", new ExternalProgramsPanel(controller));
tabs.add("Input", new InputPanel(controller));
tabs.add("Output", new OutputPanel(controller));
tabs.add("Database", new SQLPanel(controller));
tabs.add("Cache", new CachePanel(controller));
tabs.add("Logging", new LoggingPanel(controller));
tabs.add("Debug", new DebugPanel(controller));
tabs.add("Filter", new FilterPanel(controller));
this.add(tabs);
}
/**
* 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;
}
/**
* Creates a tabbed pane containing an about panel and a system properties
* panel.
*
* @return a tabbed pane.
* @param project
*/
private JTabbedPane createTabs(final ProjectInfo project) {
final JTabbedPane tabs = new JTabbedPane();
final JPanel aboutPanel = createAboutPanel(project);
aboutPanel.setBorder(AboutFrame.STANDARD_BORDER);
final String aboutTab = this.resources.getString(
"about-frame.tab.about");
tabs.add(aboutTab, aboutPanel);
final JPanel systemPanel = new SystemPropertiesPanel();
systemPanel.setBorder(AboutFrame.STANDARD_BORDER);
final String systemTab = this.resources.getString(
"about-frame.tab.system");
tabs.add(systemTab, systemPanel);
return tabs;
}
/**
* Constructor.
*
* @param file MPP file to be displayed in this view.
*/
public MppFilePanel(File file)
{
m_treeModel = new PoiTreeModel();
m_treeController = new PoiTreeController(m_treeModel);
m_treeView = new PoiTreeView(m_treeModel);
m_treeView.setShowsRootHandles(true);
m_hexDumpModel = new HexDumpModel();
m_hexDumpController = new HexDumpController(m_hexDumpModel);
setLayout(new GridLayout(0, 1, 0, 0));
m_hexDumpView = new HexDumpView(m_hexDumpModel);
JSplitPane splitPane = new JSplitPane();
splitPane.setDividerLocation(0.3);
add(splitPane);
JScrollPane scrollPane = new JScrollPane(m_treeView);
splitPane.setLeftComponent(scrollPane);
final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
splitPane.setRightComponent(tabbedPane);
tabbedPane.add("Hex Dump", m_hexDumpView);
m_treeView.addTreeSelectionListener(new TreeSelectionListener()
{
@Override public void valueChanged(TreeSelectionEvent e)
{
TreePath path = e.getPath();
Object component = path.getLastPathComponent();
if (component instanceof DocumentEntry)
{
m_hexDumpController.viewDocument((DocumentEntry) component);
}
}
});
m_treeController.loadFile(file);
}
private void buildAffineTransformOpTab(JTabbedPane tabbedPane) {
BufferedImage dstImage = null;
AffineTransform transform = AffineTransform.getScaleInstance(0.5, 0.5);
AffineTransformOp op = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
dstImage = op.filter(sourceImage, null);
tabbedPane.add("Affine Transform", new JLabel(new ImageIcon(dstImage)));
}
/**
* Creates the content pane for the demo frame.
*
* @return The content pane.
*/
private JPanel createContentPane() {
final JPanel content = new JPanel(new BorderLayout());
final JTabbedPane tabs = new JTabbedPane();
tabs.add("Alignment", createTab1Content());
tabs.add("Rotation", createTab2Content());
content.add(tabs);
return content;
}
public AboutPanel() {
setLayout(new BorderLayout(8, 8));
setBorder(new EmptyBorder(8, 8, 8, 8));
FileObject configFile = FileUtil.getConfigFile("AboutBox");
if (configFile != null) {
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add("SNAP", new SnapAboutBox());
addAboutBoxPlugins(tabbedPane, configFile);
tabbedPane.add("Licenses", new LicensesAboutBox());
add(tabbedPane, BorderLayout.CENTER);
} else {
add(new SnapAboutBox(), BorderLayout.CENTER);
}
}
public void actionPerformed(ActionEvent e)
{
JDialog dlg = new JDialog(((Main) PacketSamurai.getUserInterface()).getMainFrame(),"HTML");
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dlg.setSize(350, 400);
dlg.setLocationRelativeTo(((Main) PacketSamurai.getUserInterface()).getMainFrame());
JTabbedPane tabPane = new JTabbedPane();
// HTML
JEditorPane htmlDisplay = new JEditorPane();
htmlDisplay.setEditable(false);
htmlDisplay.setContentType("text/html");
htmlDisplay.setText(_html);
// Source
JEditorPane sourceDisplay = new JEditorPane();
sourceDisplay.setEditable(false);
sourceDisplay.setContentType("text/plain");
sourceDisplay.setText(_html);
tabPane.add(new JScrollPane(htmlDisplay), "HTML");
tabPane.add(new JScrollPane(sourceDisplay), "Source");
dlg.add(tabPane);
dlg.setVisible(true);
}
private void buildConvolveOpTab(JTabbedPane tabbedPane) {
BufferedImage dstImage = null;
float[] sharpen = new float[] {
0.0f, -1.0f, 0.0f,
-1.0f, 5.0f, -1.0f,
0.0f, -1.0f, 0.0f
};
Kernel kernel = new Kernel(3, 3, sharpen);
ConvolveOp op = new ConvolveOp(kernel);
dstImage = op.filter(sourceImage, null);
tabbedPane.add("Convolve", new JLabel(new ImageIcon(dstImage)));
}
/**
* Creates a new debugger options dialog.
*
* @param parent Parent window of the dialog.
* @param options Debugger options to display in the dialog.
*/
public COptionsDialog(final JFrame parent, final DebuggerOptions options,
final DebuggerEventSettings eventSettings) {
super(parent, "Available Debugger Options", true);
Preconditions.checkNotNull(parent, "IE01466: Parent argument can not be null");
Preconditions.checkNotNull(options, "IE01467: Options argument can not be null");
m_options = DebuggerOptions.newInstance(options);
setLayout(new BorderLayout());
m_exceptionSettingsPanel = new CExceptionSettingsPanel(m_options);
m_debuggerEventSettingsPanel = new CDebuggerEventSettingsPanel(eventSettings);
final JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add(new COptionsPanel(m_options), "Debug Options");
tabbedPane.add(m_exceptionSettingsPanel, "Exception Options");
tabbedPane.add(m_debuggerEventSettingsPanel, "Debugger Event Settings");
add(tabbedPane);
final JPanel buttonPanel = new JPanel(new BorderLayout());
final JButton okButton = new JButton(new AbstractAction("OK") {
private static final long serialVersionUID = -2448050114927136382L;
@Override
public void actionPerformed(final ActionEvent arg0) {
setVisible(false);
}
});
okButton.setPreferredSize(new Dimension(100, 25));
buttonPanel.add(okButton, BorderLayout.EAST);
add(buttonPanel, BorderLayout.SOUTH);
new CDialogEscaper(this);
setSize(600, 400);
setLocationRelativeTo(null);
}
/**
* Initializes the Swing components of this dialog.
*/
private void initialize() {
txAuthor = new JTextField();
txAuthor.setColumns( 40 );
txTitle = new JTextField();
txTitle.setColumns( 40 );
txKeywords = new JTextField();
txKeywords.setColumns( 40 );
txDescription = new JTextField();
txDescription.setColumns( 40 );
txFilename = new JTextField();
txFilename.setColumns( 40 );
txDataFilename = new JTextField();
txDataFilename.setColumns( 40 );
encodingModel = EncodingComboBoxModel.createDefaultModel( Locale.getDefault() );
encodingModel.sort();
cbEncoding = new JComboBox( encodingModel );
cbxStrictLayout = new JCheckBox( getResources().getString( "htmlexportdialog.strict-layout" ) ); //$NON-NLS-1$
cbxCopyExternalReferences = new JCheckBox( getResources().getString( "htmlexportdialog.copy-external-references" ) ); //$NON-NLS-1$
getFormValidator().registerButton( cbxStrictLayout );
getFormValidator().registerTextField( txFilename );
getFormValidator().registerTextField( txDataFilename );
getFormValidator().registerComboBox( cbEncoding );
final JPanel exportPane = createExportPanel();
final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
final boolean advancedSettingsTabAvail =
"true"
.equals( config
.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.zip.AdvancedSettingsAvailable" ) );
final boolean metaDataSettingsTabAvail =
"true"
.equals( config
.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.zip.MetaDataSettingsAvailable" ) );
final JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add( getResources().getString( "htmlexportdialog.export-settings" ), exportPane ); //$NON-NLS-1$
tabbedPane.add( getResources().getString( "htmlexportdialog.parameters" ), getParametersPanel() ); //$NON-NLS-1$
if ( metaDataSettingsTabAvail ) {
tabbedPane.add( getResources().getString( "htmlexportdialog.metadata-settings" ), createMetaDataPanel() ); //$NON-NLS-1$
}
if ( advancedSettingsTabAvail ) {
tabbedPane.add( getResources().getString( "htmlexportdialog.advanced-settings" ), createExportOptionsPanel() ); //$NON-NLS-1$
}
setContentPane( createContentPane( tabbedPane ) );
}
@Override
public <N, e> Unit visit(String k, JTabbedPane ret, catdata.aql.Graph<N, e> G) {
ret.add("Graph", viewGraph(G.dmg));
return Unit.unit;
}
/**
* Initialize the dialog.
*/
private void init() {
setTitle( getResources().getString( "plain-text-exportdialog.dialogtitle" ) ); //$NON-NLS-1$
messages =
new Messages( Locale.getDefault(), PlainTextExportGUIModule.BUNDLE_NAME, ObjectUtilities
.getClassLoader( PlainTextExportGUIModule.class ) );
epson9Printers = loadEpson9Printers();
epson24Printers = loadEpson24Printers();
cbEpson9PrinterType = new JComboBox( epson9Printers );
cbEpson9PrinterType.addActionListener( new SelectEpsonModelAction() );
cbEpson24PrinterType = new JComboBox( epson24Printers );
cbEpson24PrinterType.addActionListener( new SelectEpsonModelAction() );
statusBar = new JStatusBar();
final Float[] lpiModel = { PlainTextExportDialog.LPI_6, PlainTextExportDialog.LPI_10 };
final Float[] cpiModel =
{ PlainTextExportDialog.CPI_10, PlainTextExportDialog.CPI_12, PlainTextExportDialog.CPI_15,
PlainTextExportDialog.CPI_17, PlainTextExportDialog.CPI_20 };
cbLinesPerInch = new JComboBox( new DefaultComboBoxModel( lpiModel ) );
cbCharsPerInch = new JComboBox( new DefaultComboBoxModel( cpiModel ) );
final String plainPrinterName =
getResources().getString( PlainTextExportDialog.PRINTER_NAMES[PlainTextExportDialog.TYPE_PLAIN_OUTPUT] );
final String epson9PrinterName =
getResources().getString( PlainTextExportDialog.PRINTER_NAMES[PlainTextExportDialog.TYPE_EPSON9_OUTPUT] );
final String epson24PrinterName =
getResources().getString( PlainTextExportDialog.PRINTER_NAMES[PlainTextExportDialog.TYPE_EPSON24_OUTPUT] );
final String ibmPrinterName =
getResources().getString( PlainTextExportDialog.PRINTER_NAMES[PlainTextExportDialog.TYPE_IBM_OUTPUT] );
rbPlainPrinterCommandSet =
new JRadioButton( new ActionSelectPrinter( plainPrinterName, PlainTextExportDialog.TYPE_PLAIN_OUTPUT ) );
rbEpson9PrinterCommandSet =
new JRadioButton( new ActionSelectPrinter( epson9PrinterName, PlainTextExportDialog.TYPE_EPSON9_OUTPUT ) );
rbEpson24PrinterCommandSet =
new JRadioButton( new ActionSelectPrinter( epson24PrinterName, PlainTextExportDialog.TYPE_EPSON24_OUTPUT ) );
rbIBMPrinterCommandSet =
new JRadioButton( new ActionSelectPrinter( ibmPrinterName, PlainTextExportDialog.TYPE_IBM_OUTPUT ) );
txFilename = new JTextField();
encodingSelector = new EncodingSelector();
final ButtonGroup bg = new ButtonGroup();
bg.add( rbPlainPrinterCommandSet );
bg.add( rbIBMPrinterCommandSet );
bg.add( rbEpson9PrinterCommandSet );
bg.add( rbEpson24PrinterCommandSet );
getFormValidator().registerTextField( txFilename );
getFormValidator().registerButton( rbEpson24PrinterCommandSet );
getFormValidator().registerButton( rbEpson9PrinterCommandSet );
getFormValidator().registerButton( rbIBMPrinterCommandSet );
getFormValidator().registerButton( rbPlainPrinterCommandSet );
final JComponent exportPane = createExportPane();
final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
final boolean advancedSettingsTabAvail =
"true"
.equals( config
.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.plaintext.AdvancedSettingsAvailable" ) );
final JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add( getResources().getString( "plain-text-exportdialog.export-settings" ), exportPane ); //$NON-NLS-1$
tabbedPane.add( getResources().getString( "plain-text-exportdialog.parameters" ), getParametersPanel() );
if ( advancedSettingsTabAvail ) {
tabbedPane.add( getResources().getString( "plain-text-exportdialog.advanced-settings" ), createAdvancedPane() ); //$NON-NLS-1$
}
setContentPane( createContentPane( tabbedPane ) );
clear();
}
/**
* Standard constructor. There is no default constructor for this class.
*
* @param owner - the <code>Frame</code> that owns this dialog.
*/
public CommonSettingsDialog(JFrame owner) {
// Initialize our superclass with a title.
super(owner, Messages.getString("CommonSettingsDialog.title")); //$NON-NLS-1$
panTabs = new JTabbedPane();
JPanel settingsPanel = getSettingsPanel();
JScrollPane settingsPane = new JScrollPane(settingsPanel);
panTabs.add("Main", settingsPane);
JPanel tacticalOverlaySettingsPanel = getTacticalOverlaySettingsPanel();
JScrollPane tacticalOverlaySettingsPane = new JScrollPane(tacticalOverlaySettingsPanel);
panTabs.add("Graphics", tacticalOverlaySettingsPane);
JPanel keyBindPanel = getKeyBindPanel();
JScrollPane keyBindScrollPane = new JScrollPane(keyBindPanel);
panTabs.add("Key Binds", keyBindScrollPane);
JPanel buttonOrderPanel = getButtonOrderPanel();
panTabs.add("Button Order", buttonOrderPanel);
JPanel advancedSettingsPanel = getAdvancedSettingsPanel();
JScrollPane advancedSettingsPane = new JScrollPane(advancedSettingsPanel);
panTabs.add("Advanced", advancedSettingsPane);
setLayout(new BorderLayout());
getContentPane().add(panTabs, BorderLayout.CENTER);
getContentPane().add(getButtonsPanel(), BorderLayout.PAGE_END);
// Close this dialog when the window manager says to.
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancel();
}
});
// Center this dialog.
pack();
// Make the thing wide enough so a horizontal scrollbar isn't
// necessary. I'm not sure why the extra hardcoded 10 pixels
// is needed, maybe it's a ms windows thing.
setLocationAndSize(settingsPanel.getPreferredSize().width
+ settingsPane.getInsets().right + 20, settingsPanel
.getPreferredSize().height);
}
/**
* Creates a new edit panel for a color bar.
*
* @param colorBar the color bar.
*/
public DefaultColorBarEditor(ColorBar colorBar) {
super((NumberAxis) colorBar.getAxis());
this.invertPalette = colorBar.getColorPalette().isInverse();
this.stepPalette = colorBar.getColorPalette().isStepped();
this.currentPalette = new PaletteSample(colorBar.getColorPalette());
this.availablePaletteSamples = new PaletteSample[2];
this.availablePaletteSamples[0]
= new PaletteSample(new RainbowPalette());
this.availablePaletteSamples[1]
= new PaletteSample(new GreyPalette());
JTabbedPane other = getOtherTabs();
JPanel palettePanel = new JPanel(new LCBLayout(4));
palettePanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
palettePanel.add(new JPanel());
this.invertPaletteCheckBox = new JCheckBox(
localizationResources.getString("Invert_Palette"),
this.invertPalette
);
this.invertPaletteCheckBox.setActionCommand("invertPalette");
this.invertPaletteCheckBox.addActionListener(this);
palettePanel.add(this.invertPaletteCheckBox);
palettePanel.add(new JPanel());
palettePanel.add(new JPanel());
this.stepPaletteCheckBox = new JCheckBox(
localizationResources.getString("Step_Palette"),
this.stepPalette
);
this.stepPaletteCheckBox.setActionCommand("stepPalette");
this.stepPaletteCheckBox.addActionListener(this);
palettePanel.add(this.stepPaletteCheckBox);
palettePanel.add(new JPanel());
palettePanel.add(
new JLabel(localizationResources.getString("Palette"))
);
JButton button
= new JButton(localizationResources.getString("Set_palette..."));
button.setActionCommand("PaletteChoice");
button.addActionListener(this);
palettePanel.add(this.currentPalette);
palettePanel.add(button);
other.add(localizationResources.getString("Palette"), palettePanel);
}
private DownloadMapsWindow(
final Collection<String> pendingDownloadMapNames,
final List<DownloadFileDescription> allDownloads) {
super("Download Maps");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setLocationRelativeTo(null);
setMinimumSize(new Dimension(200, 200));
setIconImage(JFrameBuilder.getGameIcon());
progressPanel = new MapDownloadProgressPanel();
final Set<DownloadFileDescription> pendingDownloads = new HashSet<>();
final Collection<String> unknownMapNames = new ArrayList<>();
for (final String mapName : pendingDownloadMapNames) {
findMap(mapName, allDownloads)
.ifPresentOrElse(pendingDownloads::add, () -> unknownMapNames.add(mapName));
}
final Collection<String> installedMapNames = removeInstalledDownloads(pendingDownloads);
if (!pendingDownloads.isEmpty()) {
progressPanel.download(pendingDownloads);
}
pendingDownloads.addAll(
ClientContext.downloadCoordinator().getDownloads().stream()
.filter(download -> download.getDownloadState() != DownloadState.CANCELLED)
.map(DownloadFile::getDownload)
.collect(Collectors.toList()));
if (!unknownMapNames.isEmpty() || !installedMapNames.isEmpty()) {
SwingComponents.newMessageDialog(
formatIgnoredPendingMapsMessage(unknownMapNames, installedMapNames));
}
final Optional<String> selectedMapName = pendingDownloadMapNames.stream().findFirst();
SwingComponents.addWindowClosingListener(this, progressPanel::cancel);
final JTabbedPane outerTabs = new JTabbedPane();
final List<DownloadFileDescription> maps =
filterMaps(allDownloads, DownloadFileDescription::isMap);
outerTabs.add("Maps", newTabbedPanelForMaps(maps, pendingDownloads));
final List<DownloadFileDescription> skins =
filterMaps(allDownloads, DownloadFileDescription::isMapSkin);
outerTabs.add(
"Skins", newAvailableInstalledTabbedPanel(selectedMapName, skins, pendingDownloads));
final List<DownloadFileDescription> tools =
filterMaps(allDownloads, DownloadFileDescription::isMapTool);
outerTabs.add(
"Tools", newAvailableInstalledTabbedPanel(selectedMapName, tools, pendingDownloads));
final JSplitPane splitPane =
new JSplitPane(
JSplitPane.VERTICAL_SPLIT, outerTabs, SwingComponents.newJScrollPane(progressPanel));
splitPane.setDividerLocation(DIVIDER_POSITION);
add(splitPane);
}
/**
* Initializes the Swing components of this dialog.
*/
private void initialize() {
txAuthor = new JTextField();
txAuthor.setColumns( 40 );
txTitle = new JTextField();
txTitle.setColumns( 40 );
txKeywords = new JTextField();
txKeywords.setColumns( 40 );
txDescription = new JTextField();
txDescription.setColumns( 40 );
txFilename = new JTextField();
txFilename.setColumns( 40 );
txDataFilename = new JTextField();
txDataFilename.setColumns( 40 );
encodingModel = EncodingComboBoxModel.createDefaultModel( Locale.getDefault() );
encodingModel.sort();
cbEncoding = new JComboBox( encodingModel );
cbxStrictLayout = new JCheckBox( getResources().getString( "htmlexportdialog.strict-layout" ) ); //$NON-NLS-1$
cbxCopyExternalReferences = new JCheckBox( getResources().getString( "htmlexportdialog.copy-external-references" ) ); //$NON-NLS-1$
getFormValidator().registerButton( cbxStrictLayout );
getFormValidator().registerTextField( txFilename );
getFormValidator().registerTextField( txDataFilename );
getFormValidator().registerComboBox( cbEncoding );
final JPanel exportPane = createExportPanel();
final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
final boolean advancedSettingsTabAvail =
"true"
.equals( config
.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.file.AdvancedSettingsAvailable" ) );
final boolean metaDataSettingsTabAvail =
"true"
.equals( config
.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.file.MetaDataSettingsAvailable" ) );
final JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add( getResources().getString( "htmlexportdialog.export-settings" ), exportPane ); //$NON-NLS-1$
tabbedPane.add( getResources().getString( "htmlexportdialog.parameters" ), getParametersPanel() );
if ( metaDataSettingsTabAvail ) {
tabbedPane.add( getResources().getString( "htmlexportdialog.metadata-settings" ), createMetaDataPanel() ); //$NON-NLS-1$
}
if ( advancedSettingsTabAvail ) {
tabbedPane.add( getResources().getString( "htmlexportdialog.advanced-settings" ), createExportOptionsPanel() ); //$NON-NLS-1$
}
setContentPane( createContentPane( tabbedPane ) );
}
public ProtocolEditor(JFrame frame)
{
super(frame);
setTitle("Packet Samurai - Protocol Editor");
setSize(800, 600);
setLayout(new BorderLayout());
_clientTab = new ProtocolTab();
_serverTab = new ProtocolTab();
//menus
JMenuBar menuBar = new JMenuBar();
//action listener
_pel = new ProtocolEditorListener(this);
// * File menu
JMenu fileMenu = new JMenu("File");
// * Reload Button
JMenuItem reloadButton = new JMenuItem("Reload");
reloadButton.setActionCommand("reload");
reloadButton.addActionListener(_pel);
// * Save Button
JMenuItem saveButton = new JMenuItem("Save");
saveButton.setActionCommand("save");
saveButton.addActionListener(_pel);
fileMenu.add(reloadButton);
fileMenu.add(saveButton);
// * Protocol menu
_protocolMenu = new JMenu("Chose Protocol");
loadProtocols();
JMenu editMenu = new JMenu("Edit");
JMenuItem protoPorpertyButton = new JMenuItem("Protocol Properties");
protoPorpertyButton.setActionCommand("properties");
protoPorpertyButton.addActionListener(_pel);
editMenu.add(protoPorpertyButton);
menuBar.add(fileMenu);
menuBar.add(_protocolMenu);
menuBar.add(editMenu );
setJMenuBar(menuBar);
// tabs
JTabbedPane tabPane = new JTabbedPane();
tabPane.add(_clientTab);
tabPane.add(_serverTab);
add(tabPane);
}
public SubmissionTree(OptionPanel gui) {
this.setTitle(Messages.getString("SubmissionTree.SubmissionTree_Title")); //$NON-NLS-1$
this.setBackground(JPlagCreator.SYSTEMCOLOR);
this.gui = gui;
JPanel contentPane = new JPanel();
contentPane.setPreferredSize(new Dimension(350, 550));
contentPane.setLayout(new BorderLayout());
contentPane.setBackground(JPlagCreator.SYSTEMCOLOR);
JTabbedPane mainPanel = new JTabbedPane();
mainPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
makeInvalidTree();
invalidTree = new JTree(invalidRoot, true);
invalidTree.setName("JPlag Preview tree"); //$NON-NLS-1$
JScrollPane invalidScroll = new JScrollPane(invalidTree);
invalidScroll.getViewport().setBackground(JPlagCreator.SYSTEMCOLOR);
invalidScroll.getVerticalScrollBar()
.setBackground(JPlagCreator.SYSTEMCOLOR);
invalidScroll.setBackground(Color.WHITE);
invalidScroll.setPreferredSize(new Dimension(350, 500));
makeValidTree();
validTree = new JTree(validRoot, true);
validTree.setName("JPlag Preview tree"); //$NON-NLS-1$
// This workaround removes all expand controls from empty nodes
expandAll();
collapseAll();
JScrollPane validScroll = new JScrollPane(validTree);
validScroll.setBackground(JPlagCreator.SYSTEMCOLOR);
validScroll.getViewport().setBackground(JPlagCreator.SYSTEMCOLOR);
validScroll.getVerticalScrollBar().setBackground(
JPlagCreator.SYSTEMCOLOR);
validScroll.setBackground(Color.WHITE);
validScroll.setPreferredSize(new Dimension(350, 500));
mainPanel.setFont(JPlagCreator.SYSTEM_FONT);
mainPanel.add(Messages.getString("SubmissionTree.Recognized_Structure"), validScroll); //$NON-NLS-1$
mainPanel.add(Messages.getString("SubmissionTree.Invalid_Items"), invalidScroll); //$NON-NLS-1$
mainPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
JPanel pan = JPlagCreator.createPanelWithoutBorder(350,50,10,0,FlowLayout.CENTER);
JPanel buttons = JPlagCreator.createPanelWithoutBorder(350, 30, 0, 15,FlowLayout.CENTER);
JButton button = JPlagCreator.createButton(
Messages.getString("SubmissionTree.Expand_all"), //$NON-NLS-1$
Messages.getString("SubmissionTree.Expand_all_TIP"), //$NON-NLS-1$
100, 20);
button.setActionCommand("expand"); //$NON-NLS-1$
button.addActionListener(this);
buttons.add(button);
button = JPlagCreator.createButton(
Messages.getString("SubmissionTree.Collapse_all"), //$NON-NLS-1$
Messages.getString("SubmissionTree.Collapse_all_TIP"), //$NON-NLS-1$
100, 20);
button.setActionCommand("collapse"); //$NON-NLS-1$
button.addActionListener(this);
buttons.add(button);
button = JPlagCreator.createButton(
Messages.getString("SubmissionTree.Close"), //$NON-NLS-1$
Messages.getString("SubmissionTree.Close_TIP"), //$NON-NLS-1$
100, 20);
button.setActionCommand("close"); //$NON-NLS-1$
button.addActionListener(this);
buttons.add(button);
pan.add(buttons);
contentPane.add(mainPanel, BorderLayout.CENTER);
contentPane.add(pan, BorderLayout.SOUTH);
setContentPane(contentPane);
pack();
setVisible(true);
addWindowListener(this);
}