javax.swing.JSplitPane#setTopComponent ( )源码实例Demo

下面列出了javax.swing.JSplitPane#setTopComponent ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: CSSStylesSelectionPanel.java
/**
 * 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);
}
 
源代码2 项目: diirt   文件: VisualProfiler.java
/**
 * Adds all graphical user interface components to the <code>JPanel</code>.
 */
private void addComponents(){
    //Tabs
    tabs.addTab("Profile 1D Table", profile1DTable);
    tabs.addTab("Profile 2D Table", profile2DTable);
    tabs.addTab("Control Panel", analyzePanel);
    tabs.addTab("File Browser", fileViewer);

    JSplitPane top = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    top.setTopComponent(settingsPanel);
    top.setBottomComponent(tabs);

    JSplitPane bottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    bottom.setTopComponent(top);
    bottom.setBottomComponent(console);

    //Add to panel hiearchy
    this.add(bottom);
}
 
源代码3 项目: binnavi   文件: CCombinedRightPanel.java
private static JPanel createTypePanels(final JFrame parent, final CGraphModel model,
    final TypeManager typeManager) {
  final JPanel typePanel = new JPanel(new BorderLayout());
  final JPanel typeEditorPanel = TypeEditorPanel.CreateDefaultTypeEditor(parent, typeManager);
  if (isFunctionFlowgraph(model)) {
    final JSplitPane splitPaneTop = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPaneTop.setBorder(BorderFactory.createEmptyBorder());
    splitPaneTop.setOneTouchExpandable(true);
    final JSplitPane splitPaneBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPaneBottom.setBorder(BorderFactory.createEmptyBorder());
    splitPaneBottom.setOneTouchExpandable(true);
    splitPaneTop.setTopComponent(createPrototypePanel(parent, model, typeManager));
    splitPaneTop.setBottomComponent(createStackFramePanel(parent, model, typeManager));
    splitPaneBottom.setTopComponent(splitPaneTop);
    splitPaneBottom.setBottomComponent(typeEditorPanel);
    typePanel.add(splitPaneBottom);
  } else {
    typePanel.add(typeEditorPanel, BorderLayout.CENTER);
  }
  return typePanel;
}
 
源代码4 项目: settlers-remake   文件: DatFileViewer.java
private DatFileViewer() {
	glCanvas = new Surface();

	JPanel infoField = new JPanel();
	infoField.setLayout(new BoxLayout(infoField, BoxLayout.PAGE_AXIS));

	lblDatType = new JLabel();
	lblNumUiSeqs = new JLabel();
	lblNumSettlerSeqs = new JLabel();
	lblNumLandscapeSeqs = new JLabel();

	infoField.add(lblDatType);
	infoField.add(lblNumSettlerSeqs);
	infoField.add(lblNumLandscapeSeqs);
	infoField.add(lblNumUiSeqs);

	listItems = new DefaultListModel<>();
	listView = new JList<>(listItems);
	listView.getSelectionModel().addListSelectionListener(this);

	JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	splitPane2.setTopComponent(new JScrollPane(listView));
	splitPane2.setBottomComponent(infoField);
	splitPane2.setResizeWeight(0.5);
	splitPane2.setEnabled(false);

	JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
	splitPane.setLeftComponent(splitPane2);
	splitPane.setRightComponent(glCanvas);
	splitPane.setResizeWeight(0.10);

	this.setTitle("DatFileViewer");
	this.setJMenuBar(createMenu());
	this.getContentPane().add(splitPane);
	this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	this.setSize(new Dimension(800, 600));
	this.setVisible(true);
}
 
源代码5 项目: xyTalk-pc   文件: ChatPanel.java
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));

}
 
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);

}
 
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);
}
 
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);
}
 
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);
}
 
源代码10 项目: HiJson   文件: MainView.java
private void codeChangeAction(){
    javax.swing.JDialog dlg = new javax.swing.JDialog(getFrame());
    dlg.setTitle(resourceMap.getString("menuItemCode.text"));
    dlg.setSize(500, 350);
    dlg.setMinimumSize(new Dimension(500, 350));
    JSplitPane spiltPane2 = new JSplitPane();
    spiltPane2.setDividerLocation(150);
    spiltPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);

    final JTextArea textAreaSrc = new JTextArea();
    final JTextArea textAreaDest = new JTextArea();
    textAreaSrc.setLineWrap(true);
    textAreaDest.setLineWrap(true);

    spiltPane2.setTopComponent(new JScrollPane(textAreaSrc));
    spiltPane2.setBottomComponent(new JScrollPane(textAreaDest));

    JButton btnOK = new JButton("转换");
    btnOK.setSize(50, 25);
    java.awt.Container pane = dlg.getContentPane();
    BorderLayout layout = new BorderLayout();
    //layout.addLayoutComponent(spiltPane, BorderLayout.CENTER);
   // layout.addLayoutComponent(btnOK, BorderLayout.SOUTH);
    pane.setLayout(layout);
    pane.add(spiltPane2,  BorderLayout.CENTER);
    pane.add(btnOK,  BorderLayout.SOUTH);

    btnOK.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String str = textAreaSrc.getText();
            str = StringEscapeUtils.unescapeJava(str);
            textAreaDest.setText(str);
        }
    });
    MainApp.getApplication().show(dlg);

}
 
源代码11 项目: pentaho-reporting   文件: SimpleDemoFrame.java
protected JComponent createDefaultContentPane()
{
  final JPanel content = new JPanel(new BorderLayout());
  content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

  final InternalDemoHandler demoHandler = getDemoHandler();
  final JEditorPane editorPane = new JEditorPane();
  final URL url = demoHandler.getDemoDescriptionSource();
  editorPane.setEditable(false);
  editorPane.setPreferredSize(new Dimension(400, 200));
  if (url != null)
  {
    try
    {
      editorPane.setPage(url);
    }
    catch (IOException e)
    {
      editorPane.setText("Unable to load the demo description. Error: " + e.getMessage());
    }
  }
  else
  {
    editorPane.setText("Unable to load the demo description. No such resource.");
  }

  final JScrollPane scroll = new JScrollPane(editorPane,
      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

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

  final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  splitPane.setTopComponent(scroll);
  splitPane.setBottomComponent(demoHandler.getPresentationComponent());
  content.add(splitPane, BorderLayout.CENTER);
  content.add(previewButton, BorderLayout.SOUTH);
  return content;
}
 
源代码12 项目: open-ig   文件: CELabelsPanel.java
/** Initialize the GUI. */
private void initGUI() {
	verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	
	verticalSplit.setTopComponent(createTopPanel());
	verticalSplit.setBottomComponent(createBottomPanel());
	verticalSplit.setResizeWeight(0.75);
	
	setLayout(new BorderLayout());
	add(verticalSplit, BorderLayout.CENTER);
	
	doUpdateCount();
}
 
源代码13 项目: swift-k   文件: TasksRenderer.java
protected JComponent createFileStuff() {
	JSplitPane t = new JSplitPane(VERTICAL_SPLIT);
	t.setResizeWeight(0.5);
	t.setTopComponent(createTransferTable());
	t.setBottomComponent(createFileopTable());
	return t;
}
 
源代码14 项目: snap-desktop   文件: ToolAdapterEditorDialog.java
@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;
}
 
源代码15 项目: marathonv5   文件: TreeIconDemo.java
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);
}
 
源代码16 项目: marathonv5   文件: TreeIconDemo2.java
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);
}
 
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);
    }
 
源代码18 项目: orbit-image-analysis   文件: PropertySheetPanel.java
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);
}
 
源代码19 项目: open-ig   文件: CETechnologyPanel.java
/**
 * 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);
}
 
源代码20 项目: CodenameOne   文件: PropertySheetPanel.java
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));
  actionPanel.setOpaque(false);
  add("North", actionPanel);

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

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

  descriptionButton = new JToggleButton(new ToggleDescriptionAction());
  descriptionButton.setUI(new BlueishButtonUI());
  descriptionButton.setText(null);
  descriptionButton.setOpaque(false);
  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();
  tableScroll.setBorder(BorderFactory.createEmptyBorder());
  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);
}