Java Code Examples for javax.swing.JSplitPane#setBottomComponent()

The following examples show how to use javax.swing.JSplitPane#setBottomComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSplitPaneBuilder.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
/** Builds the swing component. */
public JSplitPane build() {
  final JSplitPane pane = new JSplitPane();
  pane.setDividerLocation(dividerLocation);
  pane.setResizeWeight(extraSpaceToTopAndLeft ? 1.0 : 0.0);

  if (left != null) {
    Preconditions.checkNotNull(right);
    Preconditions.checkState(top == null);
    Preconditions.checkState(bottom == null);

    pane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    pane.setLeftComponent(left);
    pane.setRightComponent(right);
  } else {
    Preconditions.checkNotNull(top);
    Preconditions.checkNotNull(bottom);
    Preconditions.checkState(right == null);

    pane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    pane.setTopComponent(top);
    pane.setBottomComponent(bottom);
  }

  return pane;
}
 
Example 2
Source File: CompoundDemoFrame.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected JComponent createDefaultDemoPane(final InternalDemoHandler demoHandler)
{
  final JPanel content = new JPanel(new BorderLayout());
  content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

  final URL url = demoHandler.getDemoDescriptionSource();
  final JComponent scroll = createDescriptionTextPane(url);

  final JButton previewButton = new JButton(getPreviewAction());

  final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  splitPane.setTopComponent(scroll);
  splitPane.setBottomComponent(demoHandler.getPresentationComponent());
  splitPane.setDividerLocation(200);
  splitPane.setOneTouchExpandable(true);
  content.add(splitPane, BorderLayout.CENTER);
  content.add(previewButton, BorderLayout.SOUTH);
  return content;
}
 
Example 3
Source File: CSSStylesSelectionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@code CSSStylesSelectionPanel}.
 */
CSSStylesSelectionPanel() {
    setLayout(new BorderLayout());
    JSplitPane splitPane = createSplitPane();
    splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(initPropertyPane());
    splitPane.setBottomComponent(initRulePane());
    splitPane.setDividerSize(4);
    splitPane.setResizeWeight(0.5);
    splitPane.setBorder(null);
    selectionView = splitPane;
    initMessagePanel();
    initSelectionOfOwningRule();
    add(selectionView, BorderLayout.CENTER);
    updateContent(null, false);
}
 
Example 4
Source File: ChatPanel.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initView() {
	this.setLayout(new GridLayout(1, 1));

	if (roomId == null) {
		messagePanel.setVisible(false);
		messageEditorPanel.setVisible(false);
		DebugUtil.debug("roomId == null");
	}

	splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
	// splitPane.setBorder(new RCBorder(RCBorder.BOTTOM,
	// Colors.LIGHT_GRAY));
	splitPane.setBorder(null);
	// splitPane.setUI(new BasicSplitPaneUI());
	// BasicSplitPaneDivider divider = (BasicSplitPaneDivider)
	// splitPane.getComponent(0);
	// divider.setBackground(Colors.FONT_BLACK);
	// divider.setBorder(null);
	splitPane.setOneTouchExpandable(false);
	splitPane.setDividerLocation(450);
	// splitPane.setResizeWeight(0.1);
	splitPane.setDividerSize(2);

	splitPane.setTopComponent(messagePanel);
	splitPane.setBottomComponent(messageEditorPanel);
	splitPane.setPreferredSize(new Dimension(MainFrame.DEFAULT_WIDTH, MainFrame.DEFAULT_HEIGHT));
	// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
	// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 10));
	add(splitPane);
	// add(messagePanel, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
	// add(messageEditorPanel, new GBC(0, 1).setFill(GBC.BOTH).setWeight(1,
	// 1));

}
 
Example 5
Source File: TasksRenderer.java    From swift-k with Apache License 2.0 5 votes vote down vote up
protected JComponent createFileStuff() {
	JSplitPane t = new JSplitPane(VERTICAL_SPLIT);
	t.setResizeWeight(0.5);
	t.setTopComponent(createTransferTable());
	t.setBottomComponent(createFileopTable());
	return t;
}
 
Example 6
Source File: ImageTreePanel.java    From moa with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 * @param chart
 */
public ImageTreePanel(ImageChart chart[]) {
    super(new GridLayout(1, 0));
    this.chart = chart;
    //Create the nodes.
    DefaultMutableTreeNode top
            = new DefaultMutableTreeNode("Images");
    imgPanel = new JPanel();
    imgPanel.setLayout(new GridLayout(1, 0));
    createNodes(top);
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    tree.setSelectionRow(1);

    tree.addTreeSelectionListener(this);
    ImageIcon leafIcon = new ImageIcon("icon/img.png");
    if (leafIcon != null) {
        DefaultTreeCellRenderer renderer
                = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(leafIcon);
        tree.setCellRenderer(renderer);
    }
    imgPanel.updateUI();
    JScrollPane treeView = new JScrollPane(tree);
    treeView.setMinimumSize(new Dimension(100, 50));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(imgPanel);
    splitPane.setDividerLocation(100);
    splitPane.setPreferredSize(new Dimension(500, 300));
    add(splitPane);

}
 
Example 7
Source File: ImageORPanel.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setBottomComponent(objectTable);
    TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
    splitPane.setTopComponent(tSearch);
    splitPane.setResizeWeight(.5);
    splitPane.setDividerLocation(.5);
    add(splitPane);
}
 
Example 8
Source File: MobileORPanel.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setBottomComponent(objectTable);
    TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
    splitPane.setTopComponent(tSearch);
    splitPane.setResizeWeight(.5);
    splitPane.setDividerLocation(.5);
    add(splitPane);
}
 
Example 9
Source File: WebORPanel.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setBottomComponent(objectTable);
    TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
    splitPane.setTopComponent(tSearch);
    splitPane.setResizeWeight(.5);
    splitPane.setDividerLocation(.5);
    add(splitPane);
}
 
Example 10
Source File: TestDesignUI.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    projectNReusableTreeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    projectNReusableTreeSplitPane.setOneTouchExpandable(true);
    projectNReusableTreeSplitPane.setResizeWeight(0.5);

    projectNReusableTreeSplitPane.setTopComponent(getTreeInPanel("Test Plan", testDesign.getProjectTree().getTree()));

    appReusablePanel = getRTreeInPanel("Reusable Component", testDesign.getReusableTree().getTree());
    projectNReusableTreeSplitPane.setBottomComponent(appReusablePanel);

    testCaseNTestDataSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    testCaseNTestDataSplitPane.setOneTouchExpandable(true);
    testCaseNTestDataSplitPane.setResizeWeight(0.5);

    testCaseNTestDataSplitPane.setTopComponent(testDesign.getTestCaseComponent());
    testCaseNTestDataSplitPane.setBottomComponent(testDesign.getTestDatacomp());

    oneTwo = new JSplitPane();
    oneTwo.setOneTouchExpandable(true);
    oneTwo.setResizeWeight(0.25);

    oneTwo.setLeftComponent(projectNReusableTreeSplitPane);
    oneTwo.setRightComponent(testCaseNTestDataSplitPane);

    oneThree = new JSplitPane();
    oneThree.setOneTouchExpandable(true);
    oneThree.setResizeWeight(0.8);

    oneThree.setLeftComponent(oneTwo);
    oneThree.setRightComponent(testDesign.getObjectRepo());

    add(oneThree);

}
 
Example 11
Source File: TreeIconDemo2.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public TreeIconDemo2() {
    super(new GridLayout(1, 0));

    // Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
    createNodes(top);

    // Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Enable tool tips.
    ToolTipManager.sharedInstance().registerComponent(tree);

    // Set the icon for leaf nodes.
    ImageIcon tutorialIcon = createImageIcon("images/middle.gif");
    if (tutorialIcon != null) {
        tree.setCellRenderer(new MyRenderer(tutorialIcon));
    } else {
        System.err.println("Tutorial icon missing; using default.");
    }

    // Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    // Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    // Create the HTML viewing pane.
    htmlPane = new JEditorPane();
    htmlPane.setEditable(false);
    initHelp();
    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(htmlView);

    Dimension minimumSize = new Dimension(100, 50);
    htmlView.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(100); // XXX: ignored in some releases
                                       // of Swing. bug 4101306
    // workaround for bug 4101306:
    // treeView.setPreferredSize(new Dimension(100, 100));

    splitPane.setPreferredSize(new Dimension(500, 300));

    // Add the split pane to this panel.
    add(splitPane);
}
 
Example 12
Source File: MainGui.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
private void defineLayout ()
{
    // +=============================================================+
    // |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
    // |+=================+=============================+===========+|
    // || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
    // |+=================+=============================+===========+|
    // +=============================================================+
    // | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
    // |+=========================================+=================+|
    // | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
    // | +========================================+ . . . . . . . . ||
    // | | stubsController . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // |m| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // |a| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // |n| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
    // |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 =  stubsController / bottomPane
    mainPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, stubsController.getComponent(), null);
    mainPane.setBorder(null);
    mainPane.setOneTouchExpandable(true);
    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);

    // Display the boards pane?
    if (GuiActions.getInstance().isBoardsWindowDisplayed()) {
        appPane.add(boardsScrollPane, BorderLayout.EAST);
    }

    // Display the log pane?
    if (GuiActions.getInstance().isLogWindowDisplayed()) {
        bottomPane.setLeftComponent(logPane.getComponent());
    }

    // Display the errors pane?
    if (GuiActions.getInstance().isErrorsWindowDisplayed()) {
        bottomPane.setRightComponent(null);
    }

    // BottomPane = Log & Errors
    if (needBottomPane()) {
        mainPane.setBottomComponent(bottomPane);
    }
}
 
Example 13
Source File: PropertySheetPanel.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
private void buildUI() {
  LookAndFeelTweaks.setBorderLayout(this);
  LookAndFeelTweaks.setBorder(this);

  actionPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0));
  actionPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
  add("North", actionPanel);

  sortButton = new JToggleButton(new ToggleSortingAction());
  sortButton.setUI(new BlueishButtonUI());
  sortButton.setText(null);
  actionPanel.add(sortButton);

  asCategoryButton = new JToggleButton(new ToggleModeAction());
  asCategoryButton.setUI(new BlueishButtonUI());
  asCategoryButton.setText(null);
  actionPanel.add(asCategoryButton);

  descriptionButton = new JToggleButton(new ToggleDescriptionAction());
  descriptionButton.setUI(new BlueishButtonUI());
  descriptionButton.setText(null);
  actionPanel.add(descriptionButton);

  split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  split.setBorder(null);
  split.setResizeWeight(1.0);
  split.setContinuousLayout(true);
  add("Center", split);
  
  tableScroll = new JScrollPane();
  split.setTopComponent(tableScroll);

  descriptionPanel = new JEditorPane("text/html", "<html>");
  descriptionPanel.setBorder(BorderFactory.createEmptyBorder());
  descriptionPanel.setEditable(false);
  descriptionPanel.setBackground(UIManager.getColor("Panel.background"));
  LookAndFeelTweaks.htmlize(descriptionPanel);

  selectionListener = new SelectionListener();

  descriptionScrollPane = new JScrollPane(descriptionPanel);
  descriptionScrollPane.setBorder(LookAndFeelTweaks.addMargin(BorderFactory
    .createLineBorder(UIManager.getColor("controlDkShadow"))));
  descriptionScrollPane.getViewport().setBackground(
    descriptionPanel.getBackground());
  descriptionScrollPane.setMinimumSize(new Dimension(50, 50));
  split.setBottomComponent(descriptionScrollPane);
  
  // by default description is not visible, toolbar is visible.
  setDescriptionVisible(false);
  setToolBarVisible(true);
}
 
Example 14
Source File: TreeIconDemo.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public TreeIconDemo() {
    super(new GridLayout(1, 0));

    // Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
    createNodes(top);

    // Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Set the icon for leaf nodes.
    ImageIcon leafIcon = createImageIcon("images/middle.gif");
    if (leafIcon != null) {
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(leafIcon);
        tree.setCellRenderer(renderer);
    } else {
        System.err.println("Leaf icon missing; using default.");
    }

    // Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    // Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    // Create the HTML viewing pane.
    htmlPane = new JEditorPane();
    htmlPane.setEditable(false);
    initHelp();
    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(htmlView);

    Dimension minimumSize = new Dimension(100, 50);
    htmlView.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(100); // XXX: ignored in some releases
                                       // of Swing. bug 4101306
    // workaround for bug 4101306:
    // treeView.setPreferredSize(new Dimension(100, 100));

    splitPane.setPreferredSize(new Dimension(500, 300));

    // Add the split pane to this panel.
    add(splitPane);
}
 
Example 15
Source File: TreeDemo.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public TreeDemo() {
    super(new GridLayout(1, 0));

    // Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
    createNodes(top);

    // Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    if (playWithLineStyle) {
        System.out.println("line style = " + lineStyle);
        tree.putClientProperty("JTree.lineStyle", lineStyle);
    }

    // Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    // Create the HTML viewing pane.
    htmlPane = new JEditorPane();
    htmlPane.setEditable(false);
    initHelp();
    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(htmlView);

    Dimension minimumSize = new Dimension(100, 50);
    htmlView.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(100);
    splitPane.setPreferredSize(new Dimension(500, 300));

    // Add the split pane to this panel.
    add(splitPane);
}
 
Example 16
Source File: CampaignEditor.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Initialize the internal components.
 */
private void initComponents() {
	undoManager = new UndoManager();
	
	warning = new ImageIcon(CampaignEditor.class.getResource("/hu/openig/gfx/warning.png"));
	error = new ImageIcon(CampaignEditor.class.getResource("/hu/openig/gfx/error.png"));
	
	labels = new HashMap<>();
	flags = new HashMap<>();
	
	// fetch labels
	try {
		XElement xlabels = XElement.parseXML(CampaignEditor.class.getResource("ce_labels.xml"));
		for (XElement xlang : xlabels.childrenWithName("language")) {
			String id = xlang.get("id");
			if (id.equals(language)) {
				for (XElement xentry : xlang.childrenWithName("entry")) {
					String key = xentry.get("key");
					if (key != null && !key.isEmpty() && xentry.content != null && !xentry.content.isEmpty()) {
						labels.put(key, xentry.content);
					}
				}
			}
			flags.put(id, new ImageIcon(CampaignEditor.class.getResource(xlang.get("flag"))));
		}
	} catch (XMLStreamException | IOException ex) {
		Exceptions.add(ex);
	}
	
	ToolTipManager.sharedInstance().setDismissDelay(120000);
	
	mainMenu = new JMenuBar();
	
	initMenu();

	toolbar = new JToolBar();
	
	initToolbar();
	
	mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

	tabs = new JTabbedPane();
	
	initTabs();
	
	problemPanel = new JPanel();
	
	mainSplit.setTopComponent(tabs);
	mainSplit.setBottomComponent(problemPanel);
	mainSplit.setOneTouchExpandable(true);
	mainSplit.setResizeWeight(1d);
	
	setJMenuBar(mainMenu);
	
	Container c = getContentPane();
	
	c.add(toolbar, BorderLayout.PAGE_START);
	c.add(mainSplit, BorderLayout.CENTER);
	// TODO other stuff
	
	updateUndoRedo();
	startupDialog = new CEStartupDialog(this);
	
	// FIXME disabled menu and toolbars
	
	mnuFileOpen.setEnabled(false);
	mnuFileSave.setEnabled(false);
	mnuFileSaveAs.setEnabled(false);
	mnuFileImport.setEnabled(false);
	mnuFileExport.setEnabled(false);
	
	mnuEditCopy.setEnabled(false);
	mnuEditCut.setEnabled(false);
	mnuEditPaste.setEnabled(false);
	mnuEditDelete.setEnabled(false);
	
	mnuHelpAbout.setEnabled(false);
	
	toolbarOpen.setEnabled(false);
	toolbarSave.setEnabled(false);
	toolbarImport.setEnabled(false);
	toolbarExport.setEnabled(false);
	toolbarCut.setEnabled(false);
	toolbarCopy.setEnabled(false);
	toolbarPaste.setEnabled(false);
	toolbarRemove.setEnabled(false);
	toolbarSaveAs.setEnabled(false);
}
 
Example 17
Source File: ToolExecutionForm.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
public ToolExecutionForm(AppContext appContext, ToolAdapterOperatorDescriptor descriptor, PropertySet propertySet,
                         TargetProductSelector targetProductSelector) {
    this.appContext = appContext;
    this.operatorDescriptor = descriptor;
    this.propertySet = propertySet;
    this.targetProductSelector = targetProductSelector;

    //before executing, the sourceProduct and sourceProductFile must be removed from the list, since they cannot be edited
    Property sourceProperty = this.propertySet.getProperty(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE);
    if(sourceProperty != null) {
        this.propertySet.removeProperty(sourceProperty);
    }
    sourceProperty = this.propertySet.getProperty(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID);
    if(sourceProperty != null) {
        this.propertySet.removeProperty(sourceProperty);
    }
    // if the tool is handling by itself the output product name, then remove targetProductFile from the list,
    // since it may bring only confusion in this case
    if (operatorDescriptor.isHandlingOutputName()) {
        sourceProperty = this.propertySet.getProperty(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE);
        if (sourceProperty != null) {
            this.propertySet.removeProperty(sourceProperty);
        }
    }

    //initialise the target product's directory to the working directory
    final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel();
    targetProductSelectorModel.setProductDir(operatorDescriptor.resolveVariables(operatorDescriptor.getWorkingDir()));

    if(!operatorDescriptor.isHandlingOutputName() || operatorDescriptor.getSourceProductCount() > 0) {
        ioParamPanel = createIOParamTab();
        addTab("I/O Parameters", ioParamPanel);
    }
    JPanel processingParamPanel = new JPanel(new SpringLayout());
    checkDisplayOutput = new JCheckBox("Display execution output");
    checkDisplayOutput.setSelected(Boolean.parseBoolean(NbPreferences.forModule(Dialogs.class).get(ToolAdapterOptionsController.PREFERENCE_KEY_SHOW_EXECUTION_OUTPUT, "false")));
    processingParamPanel.add(checkDisplayOutput);
    bottomPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    bottomPane.setTopComponent(createProcessingParamTab());
    console = new ConsolePane();
    if (checkDisplayOutput.isSelected()) {
        bottomPane.setBottomComponent(console);
        bottomPane.setDividerLocation(0.6);
    }
    processingParamPanel.add(bottomPane);
    checkDisplayOutput.addActionListener((ActionEvent e) -> {
        if (!checkDisplayOutput.isSelected()) {
            bottomPane.remove(console);
        } else {
            bottomPane.setBottomComponent(console);
        }
        refreshDimension();
    });
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    setPreferredSize(new Dimension((int)(screen.getWidth() / 3), (int)(screen.getHeight() / 2.5)));
    setMinimumSize(new Dimension(200, 200));
    SpringUtilities.makeCompactGrid(processingParamPanel, 2, 1, 2, 2, 2, 2);
    addTab("Processing Parameters", processingParamPanel);
    updateTargetProductFields();
}
 
Example 18
Source File: CETechnologyPanel.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Construct the GUI.
 */
private void initGUI() {
	technologiesModel = new GenericTableModel<XElement>() {
		/** */
		private static final long serialVersionUID = 2557373261832556243L;

		@Override
		public Object getValueFor(XElement item, int rowIndex,
				int columnIndex) {
			switch (columnIndex) {
			case 0: return rowIndex;
			case 1: return item.get("id", "");
			case 2: return context.dataManager().label(item.get("name", null));
			case 3: return context.get(item.get("category", null));
			case 4: return item.getIntObject("level");
			case 5: return item.get("race", null);
			case 6: return item.getIntObject("production-cost");
			case 7: return item.getIntObject("research-cost");
			case 8: return context.getIcon(validateItem(item));
			default:
				return null;
			}
		}	
	};
	technologiesModel.setColumnNames(
			get("tech.#"),
			get("tech.id"), 
			get("tech.name"), 
			get("tech.category"),
			get("tech.level"),
			get("tech.race"), 
			get("tech.research_cost"),
			get("tech.production_cost"), 
			"");
	technologiesModel.setColumnTypes(
			Integer.class,
			String.class,
			String.class,
			String.class,
			Integer.class,
			String.class,
			Integer.class,
			Integer.class,
			ImageIcon.class
	);
	
	technologies = new JTable(technologiesModel);
	technologiesSorter = new TableRowSorter<>(technologiesModel);
	technologies.setRowSorter(technologiesSorter);
	
	technologies.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
		@Override
		public void valueChanged(ListSelectionEvent e) {
			if (!e.getValueIsAdjusting()) {
				int idx = technologies.getSelectedRow();
				if (idx >= 0) {
					idx = technologies.convertRowIndexToModel(idx);
					doDetails(technologiesModel.get(idx), idx);
				} else {
					doDetails(null, -1);
				}
			}
		}
	});
	
	
	JPanel top = createTopPanel();
	
	verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	
	verticalSplit.setTopComponent(top);
	
	JPanel bottom = createBottomPanel();
	
	verticalSplit.setBottomComponent(bottom);
	verticalSplit.setResizeWeight(0.75);
	
	setLayout(new BorderLayout());
	add(verticalSplit, BorderLayout.CENTER);
	
	doUpdateCount();
	doDetails(null, -1);
}
 
Example 19
Source File: ToolAdapterEditorDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@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;
}
 
Example 20
Source File: LobbyFrame.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public LobbyFrame(final LobbyClient lobbyClient, final ServerProperties serverProperties) {
  super("TripleA Lobby");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setIconImage(JFrameBuilder.getGameIcon());
  this.lobbyClient = lobbyClient;
  setJMenuBar(new LobbyMenu(this));
  chatTransmitter =
      new LobbyChatTransmitter(
          lobbyClient.getPlayerToLobbyConnection(), lobbyClient.getUserName());
  final Chat chat = new Chat(chatTransmitter);
  final ChatMessagePanel chatMessagePanel = new ChatMessagePanel(chat, ChatSoundProfile.LOBBY);
  chatMessagePanel.addServerMessage(serverProperties.getMessage());
  final ChatPlayerPanel chatPlayers = new ChatPlayerPanel(chat);
  chatPlayers.setPreferredSize(new Dimension(200, 600));
  chatPlayers.addActionFactory(this::lobbyPlayerRightClickMenuActions);

  tableModel =
      new LobbyGameTableModel(
          lobbyClient.isModerator(), lobbyClient.getPlayerToLobbyConnection());
  final LobbyGamePanel gamePanel =
      new LobbyGamePanel(this, lobbyClient, serverProperties.getUri(), tableModel);

  final JSplitPane leftSplit = new JSplitPane();
  leftSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
  leftSplit.setTopComponent(gamePanel);
  leftSplit.setBottomComponent(chatMessagePanel);
  leftSplit.setResizeWeight(0.5);
  gamePanel.setPreferredSize(new Dimension(700, 200));
  chatMessagePanel.setPreferredSize(new Dimension(700, 400));
  final JSplitPane mainSplit = new JSplitPane();
  mainSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
  mainSplit.setLeftComponent(leftSplit);
  mainSplit.setRightComponent(chatPlayers);
  mainSplit.setResizeWeight(1);
  add(mainSplit, BorderLayout.CENTER);
  pack();
  chatMessagePanel.requestFocusInWindow();
  setLocationRelativeTo(null);
  lobbyClient
      .getPlayerToLobbyConnection()
      .addConnectionTerminatedListener(
          reason -> {
            DialogBuilder.builder()
                .parent(this)
                .title("Connection to Lobby Closed")
                .errorMessage("Connection closed: " + reason)
                .showDialog();
            shutdown();
          });
  lobbyClient.getPlayerToLobbyConnection().addConnectionClosedListener(this::shutdown);
  addWindowListener(
      new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent e) {
          shutdown();
        }
      });
}