📄 octopusprojectframe.java
字号:
/*
* OctopusProjectFrame.java. Created on Apr 22, 2004.
*/
package org.webdocwf.util.loader.wizard;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JToolBar;
/**
* Represents OctopusProject frame. It has two tabs, one for Generator
* and one for Loader.
*
* @author Zoran Milakovic
*/
public class OctopusProjectFrame extends JInternalFrame {
JTabbedPane tabbedPane = new JTabbedPane();
OctopusLoaderPanel loaderPanel;
OctopusGeneratorPanel generatorPanel;
JToolBar toolBar;
String projectName = "";
public OctopusProjectFrame(
String name,
OctopusLoaderPanel loaderPanel,
OctopusGeneratorPanel generatorPanel,
JToolBar toolBar) {
super(name, true, false, true, true);
this.loaderPanel = loaderPanel;
this.generatorPanel = generatorPanel;
this.toolBar = toolBar;
this.projectName = name;
init();
}
private void init() {
try {
setFrameIcon( new ImageIcon(getClass().getClassLoader().getResource("org/webdocwf/util/loader/"+
"wizard/images/Enhydra16.gif")));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(toolBar,BorderLayout.NORTH);
contentPane.add(tabbedPane,BorderLayout.CENTER);
setContentPane(contentPane);
addToTab("Octopus Generator",generatorPanel);
addToTab("Octopus Loader",loaderPanel);
// setActiveTab(1);
setBounds(0, 0, 1000, 750);
}catch(Exception e) {
e.printStackTrace();
}
}
public String getProjectName() {
return this.projectName;
}
public OctopusLoaderPanel getLoaderPanel() {
return this.loaderPanel;
}
public OctopusGeneratorPanel getGeneratorPanel() {
return this.generatorPanel;
}
public void addToTab(String title, Component component) {
this.tabbedPane.add(title, component);
}
public void setActiveTab(int index) {
this.tabbedPane.setSelectedIndex(index);
}
public static JButton createOctopusButton(String componentName, Dimension dimension) {
JButton button = new JButton();
if (!componentName.equalsIgnoreCase(""))
button.setText(componentName);
button.setAlignmentX(Component.LEFT_ALIGNMENT);
button.setAlignmentY(Component.CENTER_ALIGNMENT);
button.setMinimumSize(new Dimension(dimension));
button.setMaximumSize(new Dimension(dimension));
button.setPreferredSize(new Dimension(dimension));
return button;
}
public static JComboBox createOctopusCombobox(String componentName, Dimension dimension) {
JComboBox comboBox = new JComboBox();
comboBox.setName(componentName);
comboBox.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBox.setAlignmentY(Component.CENTER_ALIGNMENT);
comboBox.setMinimumSize(new Dimension(dimension));
comboBox.setMaximumSize(new Dimension(dimension));
comboBox.setPreferredSize(new Dimension(dimension));
return comboBox;
}
public static JLabel createOctopusLabel(String componentName, Dimension dimension) {
JLabel label = new JLabel();
label.setText(componentName);
label.setAlignmentX(Component.LEFT_ALIGNMENT);
label.setAlignmentY(Component.CENTER_ALIGNMENT);
label.setMinimumSize(new Dimension(dimension));
label.setMaximumSize(new Dimension(dimension));
label.setPreferredSize(new Dimension(dimension));
return label;
}
public static JTextField createOctopusTextField(String componentName, Dimension dimension) {
JTextField textField = new JTextField();
textField.setName(componentName);
textField.setAlignmentX(Component.LEFT_ALIGNMENT);
textField.setAlignmentY(Component.CENTER_ALIGNMENT);
textField.setMinimumSize(new Dimension(dimension));
textField.setMaximumSize(new Dimension(dimension));
textField.setPreferredSize(new Dimension(dimension));
return textField;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -