下面列出了javax.swing.JSplitPane#setLeftComponent ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void remove(final OptionElement element) {
final int idx = children.indexOf(element);
if (idx < 0) return;
final JSplitPane pane = (JSplitPane) UIComponent;
if (idx == 0) {
children.remove(0);
children.add(0, FILLER1);
pane.setLeftComponent(FILLER1.getUIComponent());
} else {
children.remove(1);
children.add(1, FILLER2);
pane.setRightComponent(FILLER2.getUIComponent());
}
if (element instanceof AbstractOptionElement) ((AbstractOptionElement) element).setParent(null);
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
*/
private void $$$setupUI$$$()
{
contentPane = new JPanel();
contentPane.setLayout( new BorderLayout( 0, 0 ) );
splitPane = new JSplitPane();
contentPane.add( splitPane, BorderLayout.CENTER );
final JScrollPane scrollPane1 = new JScrollPane();
splitPane.setLeftComponent( scrollPane1 );
methodList = new JList();
scrollPane1.setViewportView( methodList );
final JScrollPane scrollPane2 = new JScrollPane();
splitPane.setRightComponent( scrollPane2 );
methodDetailTable = new JTable();
scrollPane2.setViewportView( methodDetailTable );
}
protected Component createContentPane() {
final JSplitPane mainPanel = new JSplitPane();
mainPanel.setOrientation( JSplitPane.HORIZONTAL_SPLIT );
mainPanel.setLeftComponent( provisionDataSourcePanel );
mainPanel.setRightComponent( createDetailsPanel() );
mainPanel.setDividerLocation( 300 );
return mainPanel;
}
public ChatPanel(final Chat chat, final ChatSoundProfile chatSoundProfile) {
setSize(300, 200);
chatPlayerPanel = new ChatPlayerPanel(chat);
chatMessagePanel = new ChatMessagePanel(chat, chatSoundProfile);
setLayout(new BorderLayout());
final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split.setLeftComponent(chatMessagePanel);
split.setRightComponent(chatPlayerPanel);
split.setOneTouchExpandable(false);
split.setDividerSize(DIVIDER_SIZE);
split.setResizeWeight(1);
add(split, BorderLayout.CENTER);
}
public UserControlWorkspace() {
super();
container = new JPanel();
container.setLayout(new BorderLayout());
blankPane = new JPanel();
container.add(blankPane, BorderLayout.CENTER);
JSplitPane splitPane = new JSplitPane();
splitPane.setLeftComponent(new JBasicScrollPane(createUserList()));
splitPane.setRightComponent(container);
splitPane.setDividerLocation(200);
double[][] size = {
{ TableLayout.FILL },
{ TableLayout.FILL, TableLayout.PREFERRED }
};
TableLayout tableLayout = new TableLayout(size);
tableLayout.setHGap(0);
tableLayout.setVGap(5);
setLayout(tableLayout);
add(splitPane, "0, 0");
add(createButtonSpace(), "0, 1");
}
public EditUsersDialog(JFrame frame, UserFactory userFactory,
AdminPanelPlugin plugin, Engine engine) {
super(frame, true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.factory = userFactory;
this.plugin = plugin;
this.setTitle(plugin.getString("Action.EditUsers"));
users = factory.getUsers();
groups = factory.getGroups();
qualifiers = engine.getQualifiers();
createModels();
createActions();
JComponent userPanel = createUserPanel();
JComponent groupPanel = createGroupPanel();
JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
pane.setLeftComponent(userPanel);
pane.setRightComponent(groupPanel);
JToolBar panel = new JToolBar();
panel.add(createUser).setFocusable(false);
panel.add(editUser).setFocusable(false);
panel.add(deleteUser).setFocusable(false);
panel.add(createGroup).setFocusable(false);
panel.add(deleteGroup).setFocusable(false);
JPanel panel2 = new JPanel(new BorderLayout());
panel2.add(panel, BorderLayout.NORTH);
panel2.add(pane, BorderLayout.CENTER);
pane.setDividerLocation(300);
setMainPane(panel2);
this.setMinimumSize(new Dimension(800, 600));
this.setLocationRelativeTo(null);
Options.loadOptions(this);
}
private JComponent createGroupPanel() {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
groupTable = new JTable(groupModel) {
/**
*
*/
private static final long serialVersionUID = 5000667220319722662L;
public void changeSelection(int rowIndex, int columnIndex,
boolean toggle, boolean extend) {
super.changeSelection(rowIndex, columnIndex, toggle, extend);
qualifierModel.fireTableDataChanged();
deleteGroup.setEnabled(rowIndex >= 0);
}
};
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(groupTable);
pane.setLeftComponent(scrollPane);
JScrollPane pane2 = new JScrollPane();
qualifiersTable = new JTable(qualifierModel);
pane2.setViewportView(qualifiersTable);
pane.setRightComponent(pane2);
pane.setDividerLocation(400);
return pane;
}
/**
* Inits the.
*/
private void init() {
// Set the title.
this.setTitle("Type System Editor");
JSplitPane contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
this.setContentPane(contentPane);
// Set up the type tree. Use simple DefaultTreeModel.
DefaultMutableTreeNode root = new DefaultMutableTreeNode("<html><b>No CAS!</b></html>");
DefaultTreeModel treeModel = new DefaultTreeModel(root);
this.typeTree = new JTree(treeModel);
this.typeTree.addTreeSelectionListener(new TypeTreeSelectionListener());
TreeSelectionModel treeSelectionModel = new DefaultTreeSelectionModel();
treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
this.typeTree.setSelectionModel(treeSelectionModel);
JScrollPane treePane = new JScrollPane(this.typeTree);
contentPane.setLeftComponent(treePane);
DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
cellRenderer.setLeafIcon(null);
// cellRenderer.setIcon(null);
cellRenderer.setClosedIcon(null);
cellRenderer.setOpenIcon(null);
this.typeTree.setCellRenderer(cellRenderer);
// Set up the feature table.
this.featureTable = new JTable(new FeatureTableModel());
JScrollPane featurePane = new JScrollPane(this.featureTable);
featurePane.getViewport().setBackground(Color.WHITE);
contentPane.setRightComponent(featurePane);
this.setJMenuBar(createMenuBar());
}
/**
* Helper function containing code for creating a new Window with both image and locale using defaults
* if the given parameters are null.
*
*
* @param image
* @param locale
*/
protected void createWindow(Image image,Locale locale){
if(locale == null){
System.out.println("Null locale- 'help'");
leftPane= new FileTreeReader(new File("help"));
}else{
File base = new File("help"+File.separator+locale);
System.out.println("'"+base.getAbsolutePath()+"'");
if(base.exists()){
leftPane = new FileTreeReader(base);
}else{
System.out.println("base did not exists. using help");
leftPane = new FileTreeReader(new File("help"));
}
}
rightPane = new HelpViewer(leftPane);
JScrollPane rightScroll = new JScrollPane();
rightScroll.setPreferredSize(new Dimension(600, 400));
rightScroll.getViewport().add(rightPane);
JSplitPane core = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
Container root = getContentPane();
root.add(core, BorderLayout.CENTER);
JScrollPane leftScroll = new JScrollPane();
leftScroll.setPreferredSize(new Dimension(200, 400));
leftScroll.getViewport().add(leftPane);
core.setLeftComponent(leftScroll);
core.setRightComponent(rightScroll);
pack();
setVisible(true);
}
/**
* Create the frame.
*/
public MSMSLibrarySubmissionWindow() {
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setBounds(100, 100, 854, 619);
JPanel main = new JPanel(new BorderLayout());
JSplitPane split = new JSplitPane();
split.setOrientation(JSplitPane.VERTICAL_SPLIT);
main.add(split);
setContentPane(main);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
split.setLeftComponent(contentPane);
txtResults = new ResultsTextPane();
txtResults.setEditable(false);
JScrollPane scrollResults = new JScrollPane(txtResults);
scrollResults.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
split.setRightComponent(scrollResults);
split.setResizeWeight(0.92);
// load parameter
paramSubmit = (LibrarySubmitParameters) MZmineCore.getConfiguration()
.getModuleParameters(LibrarySubmitModule.class);
pnSideMenu = new JPanel();
contentPane.add(pnSideMenu, BorderLayout.EAST);
pnSideMenu.setLayout(new BorderLayout(0, 0));
pnSettings = new JPanel();
pnSideMenu.add(pnSettings, BorderLayout.NORTH);
pnSettings.setLayout(new MigLayout("", "[][grow]", "[][][][][]"));
lblSettings = new JLabel("Masslist selection and preprocessing");
lblSettings.setFont(new Font("Tahoma", Font.BOLD, 11));
pnSettings.add(lblSettings, "cell 0 0");
// buttons
pnButtons = new JPanel();
pnSideMenu.add(pnButtons, BorderLayout.SOUTH);
this.helpURL = paramSubmit.getClass().getResource("help/help.html");
if (helpURL != null) {
helpButton = GUIUtils.addButton(pnButtons, "Help", null, this);
}
JButton btnCheck = new JButton("Check");
btnCheck.addActionListener(e -> {
if (checkParameters())
DialogLoggerUtil.showMessageDialogForTime("Check OK", "All parameters are set", 1500);
});
pnButtons.add(btnCheck);
JButton btnSubmit = new JButton("Submit");
btnSubmit.addActionListener(e -> submitSpectra());
pnButtons.add(btnSubmit);
parametersAndComponents = new Hashtable<>();
createSubmitParamPanel();
createMetaDataPanel();
// add listener
addListener();
scrollCharts = new JScrollPane();
contentPane.add(scrollCharts, BorderLayout.CENTER);
pnCharts = new JPanel();
pnCharts.setLayout(new GridLayout(0, 1));
scrollCharts.setViewportView(pnCharts);
addMenu();
}
private void initComponents()
{
setTitle(chooser.getName());
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosed(WindowEvent e)
{
//detach listeners from the chooser
treeViewModel.setDelegate(null);
listModel.setListFacade(null);
chooser.getRemainingSelections().removeReferenceListener(LanguageChooserDialog.this);
}
});
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
JSplitPane split = new JSplitPane();
JPanel leftPane = new JPanel(new BorderLayout());
//leftPane.add(new JLabel("Available Languages"), BorderLayout.NORTH);
availTable.setAutoCreateRowSorter(true);
availTable.setTreeViewModel(treeViewModel);
availTable.getRowSorter().toggleSortOrder(0);
availTable.addActionListener(new DoubleClickActionListener());
leftPane.add(new JScrollPane(availTable), BorderLayout.CENTER);
Button addButton = new Button(LanguageBundle.getString("in_sumLangAddLanguage"));
addButton.setOnAction(this::doAdd);
addButton.setGraphic(new ImageView(Icons.Forward16.asJavaFX()));
leftPane.add(GuiUtility.wrapParentAsJFXPanel(addButton), BorderLayout.PAGE_END);
split.setLeftComponent(leftPane);
JPanel rightPane = new JPanel(new BorderLayout());
JPanel labelPane = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
labelPane.add(new JLabel(LanguageBundle.getString("in_sumLangRemain")), //$NON-NLS-1$
new GridBagConstraints());
remainingLabel.setText(chooser.getRemainingSelections().get().toString());
labelPane.add(remainingLabel, gbc);
labelPane.add(new JLabel(LanguageBundle.getString("in_sumSelectedLang")), gbc); //$NON-NLS-1$
rightPane.add(labelPane, BorderLayout.PAGE_START);
list.setModel(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addActionListener(new DoubleClickActionListener());
rightPane.add(new JScrollPane(list), BorderLayout.CENTER);
Button removeButton = new Button(LanguageBundle.getString("in_sumLangRemoveLanguage"));
removeButton.setOnAction(this::doRemove);
removeButton.setGraphic(new ImageView(Icons.Back16.asJavaFX()));
rightPane.add(GuiUtility.wrapParentAsJFXPanel(removeButton), BorderLayout.PAGE_END);
split.setRightComponent(rightPane);
pane.add(split, BorderLayout.CENTER);
ButtonBar buttonBar = new OKCloseButtonBar(
this::doOK,
this::doRollback
);
pane.add(GuiUtility.wrapParentAsJFXPanel(buttonBar), BorderLayout.PAGE_END);
}
private void defineLayout ()
{
/*
* +=============================================================+
* |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
* |+=================+=============================+===========+|
* || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
* |+=================+=============================+===========+|
* +=============================================================+
* | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
* |+=========================================+=================+|
* | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
* | +========================================+ . . . . . . . . ||
* | | sheetController . . . . . . . . . . . .| . . . . . . . . ||
* | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |v| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |e| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |r| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |S| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |p| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |l| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |P+=====================+==================+ . . . . . . . . ||
* |a| logPane . . . . . . | errors . . . . . | . . . . . . . . ||
* |n| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
* |e| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
* | +=====================+==================+=================+|
* +=============================================================+
*/
// Individual panes
logPane = new LogPane();
boardsScrollPane = new BoardsScrollPane();
boardsScrollPane.setPreferredSize(new Dimension(350, 500));
// Bottom = Log & Errors
bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
bottomPane.setBorder(null);
bottomPane.setDividerSize(1);
bottomPane.setResizeWeight(0.5d); // Cut in half initially
// mainPane = sheetsController / bottomPane
mainPane = new JSplitPane(
JSplitPane.VERTICAL_SPLIT,
sheetsController.getComponent(),
null);
mainPane.setBorder(null);
mainPane.setDividerSize(1);
mainPane.setResizeWeight(0.9d); // Give bulk space to upper part
// horiSplitPane = mainPane | boards
appPane = new Panel();
appPane.setNoInsets();
appPane.setBorder(null);
appPane.setLayout(new BorderLayout());
appPane.add(mainPane, BorderLayout.CENTER); // + boardsScrollPane later
appPane.setName("appPane");
// Global layout: Use a toolbar on top and a double split pane below
///toolBar.add(toolKeyPanel);
Container content = frame.getContentPane();
content.setLayout(new BorderLayout());
content.add(
ActionManager.getInstance().getToolBar(),
BorderLayout.NORTH);
content.add(appPane, BorderLayout.CENTER);
// Suppress all internal borders, recursively
///UIUtilities.suppressBorders(frame.getContentPane());
// Display the boards pane?
if (GuiActions.getInstance()
.isBoardsDisplayed()) {
appPane.add(boardsScrollPane, BorderLayout.EAST);
}
// Display the log pane?
if (GuiActions.getInstance()
.isLogDisplayed()) {
bottomPane.setLeftComponent(logPane.getComponent());
}
// Display the errors pane?
if (GuiActions.getInstance()
.isErrorsDisplayed()) {
bottomPane.setRightComponent(null);
}
// BottomPane = Log & Errors
if (needBottomPane()) {
mainPane.setBottomComponent(bottomPane);
}
}
/**
* Add a controller to the emulator and initialize the main window. In
* addition, the main window adds listeners.
*/
private void initial() {
{
// Instantiate all components and controller
Controller controller = new Controller();
this.map = new Map();
this.operator = new Operator();
this.log = new Log();
this.menu = new MenuBar();
controller.initialController(menu, map, operator, log, controller);
}
{
// Initialize UI
JPanel panel = new JPanel();
GridBagLayout variablePanel = new GridBagLayout();
variablePanel.columnWidths = new int[] { 0, 0 };
variablePanel.rowHeights = new int[] { 0, 0, 0 };
variablePanel.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
variablePanel.rowWeights = new double[] { 1.0, 0.0,
Double.MIN_VALUE };
panel.setLayout(variablePanel);
// Initialize main frame
mainFrame = new JFrame();
mainFrame.setTitle("EdgeSim");
mainFrame.setBounds(250, 0, 1400, 1050);
mainFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
// mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); .
mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
ImageIcon icon = new ImageIcon("src/main/resources/images/icon.png"); // xxx����ͼƬ���·����2.pngͼƬ���Ƽ���ʽ
mainFrame.setIconImage(icon.getImage());
// Add menu
mainFrame.getContentPane().add(menu, BorderLayout.NORTH);
// Set the separation panel
JSplitPane MainPanel = new JSplitPane();
MainPanel.setContinuousLayout(true);
MainPanel.setResizeWeight(1);
MainPanel.setDividerLocation(0.9);
mainFrame.getContentPane().add(MainPanel, BorderLayout.CENTER);
JSplitPane MapAndLogPanel = new JSplitPane(
JSplitPane.VERTICAL_SPLIT);
MapAndLogPanel.setContinuousLayout(true);
MapAndLogPanel.setResizeWeight(0.8);
MainPanel.setDividerLocation(0.9);
MapAndLogPanel.setLeftComponent(map);
MapAndLogPanel.setRightComponent(log);
MainPanel.setLeftComponent(MapAndLogPanel);
MainPanel.setRightComponent(operator);
}
// Add listener
mainFrame.addWindowListener(new MyActionListener());
}
@Override
protected JSplitPane createMainPanel() {
JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
mainPanel.setOneTouchExpandable(false);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double widthRatio = 0.5;
formWidth = Math.max((int) (Math.min(screenSize.width, MAX_4K_WIDTH) * widthRatio), MIN_WIDTH);
double heightRatio = 0.6;
int formHeight = Math.max((int) (Math.min(screenSize.height, MAX_4K_HEIGHT) * heightRatio), MIN_HEIGHT);
getJDialog().setMinimumSize(new Dimension(formWidth + 16, formHeight + 72));
// top panel first
JSplitPane topPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
topPanel.setOneTouchExpandable(false);
JPanel descriptorPanel = createDescriptorAndVariablesAndPreprocessingPanel();
Dimension topPanelDimension = new Dimension((int)((formWidth - 3 * DEFAULT_PADDING) * 0.5), (int)((formHeight - 3 * DEFAULT_PADDING) * 0.75));
descriptorPanel.setMinimumSize(topPanelDimension);
descriptorPanel.setPreferredSize(topPanelDimension);
topPanel.setLeftComponent(descriptorPanel);
JPanel configurationPanel = createToolInfoPanel();
configurationPanel.setMinimumSize(topPanelDimension);
configurationPanel.setPreferredSize(topPanelDimension);
topPanel.setRightComponent(configurationPanel);
topPanel.setDividerLocation(0.5);
// bottom panel last
JPanel bottomPannel = createParametersPanel();
Dimension bottomPanelDimension = new Dimension(formWidth - 2 * DEFAULT_PADDING, (int)((formHeight - 3 * DEFAULT_PADDING) * 0.25));
bottomPannel.setMinimumSize(bottomPanelDimension);
bottomPannel.setPreferredSize(bottomPanelDimension);
mainPanel.setTopComponent(topPanel);
mainPanel.setBottomComponent(bottomPannel);
mainPanel.setDividerLocation(0.75);
mainPanel.setPreferredSize(new Dimension(formWidth, formHeight));
mainPanel.revalidate();
return mainPanel;
}
public static void main(String[] args) {
LibraryConfiguration.parallel = false;
LibraryConfiguration.quiet = false;
LibraryConfiguration.emit_block_debug = true;
tabs.put(TabType.SOURCE, new TabData(TabType.SOURCE));
tabs.put(TabType.BYTECODE, new TabData(TabType.BYTECODE));
tabs.put(TabType.DECOMPILED, new TabData(TabType.DECOMPILED));
tabs.put(TabType.GRAPH_0, new TabData(TabType.GRAPH_0));
tabs.put(TabType.GRAPH_1, new TabData(TabType.GRAPH_1));
tabs.put(TabType.GRAPH_2, new TabData(TabType.GRAPH_2));
JFrame frame = new JFrame("Despector");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(50, 50, 1600, 900);
JPanel contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
frame.setContentPane(contentPane);
JPanel panel = new JPanel();
contentPane.add(panel, BorderLayout.NORTH);
file_name_field = new JTextField();
panel.add(file_name_field);
file_name_field.setColumns(100);
file_name_field.setText("net.minecraft.");
JButton loadBtn = new JButton("Load");
panel.add(loadBtn);
loadBtn.addActionListener(Viewer::onLoad);
JSplitPane splitPane = new JSplitPane();
splitPane.setDividerLocation(800);
contentPane.add(splitPane, BorderLayout.CENTER);
JTabbedPane leftPane = new JTabbedPane(JTabbedPane.TOP);
splitPane.setLeftComponent(leftPane);
leftPane.addTab("Source", null, new JScrollPane(tabs.get(TabType.SOURCE).left), null);
leftPane.addTab("Bytecode", null, new JScrollPane(tabs.get(TabType.BYTECODE).left), null);
leftPane.addTab("Decompiled", null, new JScrollPane(tabs.get(TabType.DECOMPILED).left), null);
leftPane.addTab("Graph 0", null, new JScrollPane(tabs.get(TabType.GRAPH_0).left), null);
leftPane.addTab("Graph 1", null, new JScrollPane(tabs.get(TabType.GRAPH_1).left), null);
leftPane.addTab("Graph 2", null, new JScrollPane(tabs.get(TabType.GRAPH_2).left), null);
JTabbedPane rightPane = new JTabbedPane(JTabbedPane.TOP);
splitPane.setRightComponent(rightPane);
rightPane.addTab("Source", null, new JScrollPane(tabs.get(TabType.SOURCE).right), null);
rightPane.addTab("Bytecode", null, new JScrollPane(tabs.get(TabType.BYTECODE).right), null);
rightPane.addTab("Decompiled", null, new JScrollPane(tabs.get(TabType.DECOMPILED).right), null);
rightPane.addTab("Graph 0", null, new JScrollPane(tabs.get(TabType.GRAPH_0).right), null);
rightPane.addTab("Graph 1", null, new JScrollPane(tabs.get(TabType.GRAPH_1).right), null);
rightPane.addTab("Graph 2", null, new JScrollPane(tabs.get(TabType.GRAPH_2).right), null);
frame.setVisible(true);
}
/**
* Set the state of the component. The state is a bitmask of
* STATE_HAS_DESCRIPTION and STATE_HAS_TABS, and may be 0 to indicate
* no tabs or description. Calling this method will change the
* component hierarchy to reflect the requested state.
*/
public void setState(int state) {
if (state != getState()) {
synchronized (getTreeLock()) {
switch (state) {
case 0:
JComponent tc = findTabbedContainer();
if (tc != null) {
remove(tc);
}
JSplitPane jsp = findSplitPane();
if (jsp != null) {
remove(jsp);
}
break;
case PSheet.STATE_HAS_DESCRIPTION:
JSplitPane split = findSplitPane();
remove(findTabbedContainer());
if (split != null) {
addImpl(split, null, 0);
} else {
addImpl(createDescriptionComponent(), null, 0);
}
break;
case PSheet.STATE_HAS_TABS:
JScrollPane jsc = findScrollPane();
JComponent tct = findTabbedContainer();
if (tct == null) {
addImpl(createTabbedContainer(), null, 0);
}
JSplitPane spl = findSplitPane();
if (spl != null) {
remove(spl);
}
if (jsc != null) {
setTabbedContainerInnerComponent(findTabbedContainer(), jsc);
}
adjustForName(manager.getCurrentNodeName());
break;
case (PSheet.STATE_HAS_DESCRIPTION | PSheet.STATE_HAS_TABS):
JComponent tcc = findTabbedContainer();
JSplitPane splt = findSplitPane();
JScrollPane scrl = findScrollPane();
if (tcc == null) {
tcc = createTabbedContainer();
addImpl(tcc, null, 0);
}
if (splt == null) {
addImpl(createDescriptionComponent(), null, 0);
splt = findSplitPane();
}
setTabbedContainerInnerComponent(tcc, splt);
if (scrl != null) {
splt.setLeftComponent(scrl);
}
adjustForName(manager.getCurrentNodeName());
break;
default:
throw new IllegalArgumentException(Integer.toString(state));
}
}
}
revalidate();
repaint();
}
private void initComponents() {
endmemberList = new JList<>();
endmemberList.setModel(formModel.getEndmemberListModel());
endmemberList.setSelectionModel(formModel.getEndmemberListSelectionModel());
endmemberList.setPreferredSize(new Dimension(80, 160));
diagramCanvas = new DiagramCanvas();
diagramCanvas.setDiagram(formModel.getEndmemberDiagram());
formModel.getPropertyChangeSupport().addPropertyChangeListener("selectedEndmemberIndex",
evt -> diagramCanvas.repaint());
AbstractButton addButton = ToolButtonFactory.createButton(formModel.getAddAction(), false);
AbstractButton removeButton = ToolButtonFactory.createButton(formModel.getRemoveAction(), false);
AbstractButton clearButton = ToolButtonFactory.createButton(formModel.getClearAction(), false);
AbstractButton exportButton = ToolButtonFactory.createButton(formModel.getExportAction(), false);
GridBagLayout gbl = new GridBagLayout();
JPanel actionPanel = new JPanel(gbl);
actionPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 3));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.BOTH;
gbc.ipady = 2;
gbc.gridy = 0;
actionPanel.add(addButton, gbc);
gbc.gridy++;
actionPanel.add(removeButton, gbc);
gbc.gridy++;
actionPanel.add(clearButton, gbc);
gbc.gridy++;
actionPanel.add(exportButton, gbc);
gbc.gridy++;
gbc.weighty = 1;
actionPanel.add(new JLabel(), gbc);
final Color color = actionPanel.getBackground();
final float[] rgbColors = new float[3];
color.getRGBColorComponents(rgbColors);
final float factor = 0.9f;
actionPanel.setBackground(new Color(rgbColors[0] * factor, rgbColors[1] * factor, rgbColors[2] * factor));
JPanel endmemberSelectionPanel = new JPanel(new BorderLayout());
endmemberSelectionPanel.add(new JScrollPane(endmemberList), BorderLayout.CENTER);
endmemberSelectionPanel.add(actionPanel, BorderLayout.WEST);
JPanel endmemberPreviewPanel = new JPanel(new BorderLayout());
endmemberPreviewPanel.add(diagramCanvas, BorderLayout.CENTER);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setLeftComponent(endmemberSelectionPanel);
splitPane.setRightComponent(endmemberPreviewPanel);
splitPane.setBorder(BorderFactory.createEmptyBorder());
splitPane.setUI(createPlainDividerSplitPaneUI());
setLayout(new BorderLayout());
add(splitPane, BorderLayout.CENTER);
}
/**
* @return Window components.
*/
@Override
protected Component createComponents() {
createElements();
JPanel panel = new JPanel(new GridBagLayout());
// Initialize constraints
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridheight = 1;
constraints.gridwidth = 1;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.insets = new Insets(2, 2, 2, 2);
constraints.ipadx = 0;
constraints.ipady = 0;
constraints.weightx = 0;
constraints.weighty = 0;
// Page name
//constraints.gridwidth = 2;
panel.add(createPageComponents(), constraints);
constraints.gridy++;
// Contents
constraints.fill = GridBagConstraints.BOTH;
constraints.gridwidth = 1;
constraints.gridx = 0;
constraints.weightx = 1;
constraints.weighty = 1;
JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split.setLeftComponent(createLinksComponents());
split.setRightComponent(createContentsComponents());
split.setPreferredSize(new Dimension(1200, 700));
split.setMinimumSize(new Dimension(200, 200));
split.setResizeWeight(0.0);
split.setDividerLocation(200 + split.getInsets().left);
panel.add(split, constraints);
constraints.gridy++;
updateComponentState();
return panel;
}
/**
* Create the panel.
*/
public DFDSNamePanel(Engine engine, Element element) {
super(new BorderLayout());
this.engine = engine;
this.element = element;
dataPlugin = NDataPluginFactory.getExistingDataPlugin(engine);
textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setComponentPopupMenu(createSelectLanguageMenu());
textArea.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (undoManager == null)
return;
if (e.isControlDown()) {
if (e.getKeyCode() == KeyEvent.VK_Z)
if (undoManager.canUndo())
undoManager.undo();
if (e.getKeyCode() == KeyEvent.VK_Y)
if (undoManager.canRedo())
undoManager.redo();
}
}
});
if (dataPlugin != null) {
Row row = dataPlugin.findRowByGlobalId(element.getId());
if (row instanceof Function) {
Function function = (Function) row;
panel = new ArrowLinksPanel(function);
JSplitPane splitPane = new JSplitPane();
add(splitPane, BorderLayout.CENTER);
splitPane.setLeftComponent(new JScrollPane(textArea));
splitPane.setRightComponent(panel);
createChecker();
return;
}
}
add(new JScrollPane(textArea), BorderLayout.CENTER);
createChecker();
}
private void init() {
setLayout(new BorderLayout());
testSetCompNtestPlan = new JSplitPane();
testSetCompNtestPlan.setOneTouchExpandable(true);
treeSNTableSplitPane = new JSplitPane();
treeSNTableSplitPane.setOneTouchExpandable(true);
testSettreeNSettingsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
testSettreeNSettingsSplitPane.setOneTouchExpandable(true);
testplanTreeNSettingsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
testplanTreeNSettingsSplitPane.setOneTouchExpandable(true);
executionAndConsoleSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
executionAndConsoleSplitPane.setOneTouchExpandable(true);
testSettreeNSettingsSplitPane.setTopComponent(
getCompInPanel(
"TestLab",
TreeSearch.installFor(testExecution.getTestSetTree().getTree())));
testSettreeNSettingsSplitPane.setBottomComponent(
getCompInPanel(
"QuickSettings",
new JScrollPane(
testExecution.getTestSetComp()
.getQuickSettings().getUILeft(this))));
testSettreeNSettingsSplitPane.setDividerLocation(0.5);
treeSNTableSplitPane.setResizeWeight(0.25);
treeSNTableSplitPane.setLeftComponent(testSettreeNSettingsSplitPane);
executionAndConsoleSplitPane.setTopComponent(testExecution.getTestSetComp());
executionAndConsoleSplitPane.setOneTouchExpandable(true);
consolePanel = new ConsolePanel();
treeSNTableSplitPane.setRightComponent(executionAndConsoleSplitPane);
testSetCompNtestPlan.setLeftComponent(treeSNTableSplitPane);
testPullPanel = new TestPlanPullPanel();
testplanTreeNSettingsSplitPane.setTopComponent(testPullPanel);
testplanTreeNSettingsSplitPane.setBottomComponent(
getCompInPanel(
"QuickSettings",
new JScrollPane(
testExecution.getTestSetComp()
.getQuickSettings().getUIRight(this))));
testSetCompNtestPlan.setRightComponent(testplanTreeNSettingsSplitPane);
testSetCompNtestPlan.setResizeWeight(0.8);
add(testSetCompNtestPlan, BorderLayout.CENTER);
}