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

The following examples show how to use javax.swing.JSplitPane#setContinuousLayout() . 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: VectorEditorPanel.java    From SVG-Android with Apache License 2.0 7 votes vote down vote up
private void buildVectorViewer() {
    JPanel panel = new JPanel(new BorderLayout());

    JSplitPane splitter = new JSplitPane();
    splitter.setContinuousLayout(true);
    splitter.setResizeWeight(0.75);
    splitter.setBorder(null);

    VectorContentViewer contentViewer = new VectorContentViewer(mData, this);
    JScrollPane scroller = new JScrollPane(contentViewer);
    scroller.setOpaque(false);
    scroller.setBorder(null);
    scroller.getViewport().setBorder(null);
    scroller.getViewport().setOpaque(false);
    splitter.setLeftComponent(scroller);

    mImageViewer = new VectorImageViewer(mData);
    splitter.setRightComponent(mImageViewer);

    panel.add(splitter, BorderLayout.CENTER);
    add(panel);
}
 
Example 2
Source File: OurUtil.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new SplitPane containing the two components given as arguments
 *
 * @param orientation - the orientation (HORIZONTAL_SPLIT or VERTICAL_SPLIT)
 * @param first - the left component (if horizontal) or top component (if
 *            vertical)
 * @param second - the right component (if horizontal) or bottom component (if
 *            vertical)
 * @param initialDividerLocation - the initial divider location (in pixels)
 */
public static JSplitPane splitpane(int orientation, Component first, Component second, int initialDividerLocation) {
    JSplitPane x = make(new JSplitPane(orientation, first, second), new EmptyBorder(0, 0, 0, 0));
    x.setContinuousLayout(true);
    x.setDividerLocation(initialDividerLocation);
    x.setOneTouchExpandable(false);
    x.setResizeWeight(0.5);
    if (Util.onMac() && (x.getUI() instanceof BasicSplitPaneUI)) {
        boolean h = (orientation != JSplitPane.HORIZONTAL_SPLIT);
        ((BasicSplitPaneUI) (x.getUI())).getDivider().setBorder(new OurBorder(h, h, h, h)); // Makes
                                                                                           // the
                                                                                           // border
                                                                                           // look
                                                                                           // nicer
                                                                                           // on
                                                                                           // Mac
                                                                                           // OS
                                                                                           // X
    }
    return x;
}
 
Example 3
Source File: ManualHttpRequestEditorPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
private JSplitPane createSplitPane(int orientation) {
    final JTabbedPane tabbedPaneRequest = new JTabbedPane();
    tabbedPaneRequest.addTab(REQUEST_CAPTION, null, requestPanel, null);

    final JTabbedPane tabbedPaneResponse = new JTabbedPane();
    tabbedPaneResponse.addTab(RESPONSE_CAPTION, null, responsePanel, null);

    final JSplitPane splitPane =
            new JSplitPane(orientation, tabbedPaneRequest, tabbedPaneResponse);
    splitPane.setDividerSize(3);
    splitPane.setResizeWeight(0.5d);
    splitPane.setContinuousLayout(false);
    splitPane.setDoubleBuffered(true);

    int dividerLocation;
    if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
        dividerLocation = horizontalDividerLocation;
    } else {
        dividerLocation = verticalDividerLocation;
    }
    splitPane.setDividerLocation(dividerLocation);

    return splitPane;
}
 
Example 4
Source File: SplitPaneDemo.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
     * SplitPaneDemo Constructor.
     *
     * @param swingset the swingset
     */
    public SplitPaneDemo(SwingSet2 swingset) {
	super(swingset, "SplitPaneDemo"
			, "toolbar/JSplitPane.gif");

	earth = new JLabel(
			createImageIcon("splitpane/earth.jpg", getString("SplitPaneDemo.earth"))
			);
	earth.setMinimumSize(new Dimension(20, 20));

	moon = new JLabel(
			createImageIcon("splitpane/moon.jpg", getString("SplitPaneDemo.moon"))
			);
	moon.setMinimumSize(new Dimension(20, 20));
	
        splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, earth, moon);
        splitPane.setContinuousLayout(true);
//	splitPane.setOneTouchExpandable(true);//commet by jb2011

        splitPane.setDividerLocation(350);//由jb2011 从200改成现在值

	getDemoPanel().add(splitPane, BorderLayout.CENTER);
//	getDemoPanel().setBackground(Color.black);

	getDemoPanel().add(createSplitPaneControls(), BorderLayout.SOUTH);
    }
 
Example 5
Source File: PSheet.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JSplitPane createSplitPane(Component lower) {
    JSplitPane pane = new JSplitPane();

    if (firstSplit == null) {
        firstSplit = Boolean.TRUE;
    } else {
        firstSplit = Boolean.FALSE;
    }

    pane.setRightComponent(lower);
    pane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    pane.setContinuousLayout(true);
    pane.setResizeWeight(1);
    pane.setDividerLocation(0.80f);
    pane.setBorder(BorderFactory.createEmptyBorder());
    //Do not install our custom split pane UI on Nimbus L&F
    if (!"Nimbus".equals(UIManager.getLookAndFeel().getID())) {
        pane.setUI(PropUtils.createSplitPaneUI());
    }

    // #52188: default F6 behaviour doesn't make to much sense in NB 
    // property sheet and blocks NetBeans default F6
    pane.getActionMap().getParent().remove("toggleFocus");
    if( PropUtils.isAqua ) {
        pane.setBackground( UIManager.getColor("NbExplorerView.background") ); //NOI18N
    }

    return pane;
}
 
Example 6
Source File: TransferStockDetailsPane.java    From OpERP with MIT License 5 votes vote down vote up
public TransferStockDetailsPane() {
	pane = new JPanel();
	pane.setLayout(new MigLayout("",
			"[209px,grow,center][209px,grow,center]", "[][][29px][center]"));

	JLabel lblSource = new JLabel("Source");
	pane.add(lblSource, "cell 0 0");

	JLabel lblDestination = new JLabel("Destination");
	pane.add(lblDestination, "cell 1 0");
	splitPane = new JSplitPane();
	splitPane.setResizeWeight(0.5);
	splitPane.setContinuousLayout(false);
	pane.add(splitPane, "cell 0 2 2 1,alignx left,aligny top,grow");
}
 
Example 7
Source File: CPSMasterDetailModule.java    From cropplanning with GNU General Public License v3.0 5 votes vote down vote up
protected void buildUI() {
    splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT, 
                                master.getJPanel(),
                                detail.getJPanel() );
    splitPane.setDividerSize(5);
    splitPane.setDividerLocation(0.5);
    splitPane.setResizeWeight(1.0); // top get's more space
    splitPane.setOneTouchExpandable(false);
    splitPane.setContinuousLayout(true);
    initUI();
    mainPanel.add(splitPane);
}
 
Example 8
Source File: CompoundDemoFrame.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected Container createDefaultContentPane()
{

  demoContent = new JPanel();
  demoContent.setLayout(new BorderLayout());
  demoContent.setMinimumSize(new Dimension(100, 100));
  demoContent.add(getNoHandlerInfoPane(), BorderLayout.CENTER);

  JPanel placeHolder = new JPanel();
  placeHolder.setMinimumSize(new Dimension(300, 0));
  placeHolder.setPreferredSize(new Dimension(300, 0));
  placeHolder.setMaximumSize(new Dimension(300, 0));

  JPanel rootContent = new JPanel();
  rootContent.setLayout(new BorderLayout());
  rootContent.add(demoContent, BorderLayout.CENTER);
  rootContent.add(placeHolder, BorderLayout.NORTH);

  final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null,
      demoSelector);
  final DefaultTreeModel model = new DefaultTreeModel(root);
  final JTree demoTree = new JTree(model);
  demoTree.addTreeSelectionListener(new TreeSelectionHandler());

  JSplitPane rootSplitPane =
      new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
          new JScrollPane(demoTree), rootContent);
  rootSplitPane.setContinuousLayout(true);
  rootSplitPane.setDividerLocation(200);
  rootSplitPane.setOneTouchExpandable(true);
  return rootSplitPane;
}
 
Example 9
Source File: MainFrameComponentFactory.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
JSplitPane summaryTab() {
    mainFrame.setSummaryTopPanel(new JPanel());
    mainFrame.getSummaryTopPanel().setLayout(new GridLayout(0, 1));
    mainFrame.getSummaryTopPanel().setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
    //        mainFrame.getSummaryTopPanel().setMinimumSize(new Dimension(fontSize * 50, fontSize * 5));

    JPanel summaryTopOuter = new JPanel(new BorderLayout());
    summaryTopOuter.add(mainFrame.getSummaryTopPanel(), BorderLayout.NORTH);

    mainFrame.getSummaryHtmlArea().setContentType("text/html");
    mainFrame.getSummaryHtmlArea().setEditable(false);
    mainFrame.getSummaryHtmlArea().addHyperlinkListener(evt -> AboutDialog.editorPaneHyperlinkUpdate(evt));
    setStyleSheets();
    // JPanel temp = new JPanel(new BorderLayout());
    // temp.add(summaryTopPanel, BorderLayout.CENTER);
    JScrollPane summaryScrollPane = new JScrollPane(summaryTopOuter);
    summaryScrollPane.getVerticalScrollBar().setUnitIncrement((int) Driver.getFontSize());

    JSplitPane splitP = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, summaryScrollPane,
            mainFrame.getSummaryHtmlScrollPane());
    splitP.setContinuousLayout(true);
    splitP.setDividerLocation(GUISaveState.getInstance().getSplitSummary());
    splitP.setOneTouchExpandable(true);
    splitP.setUI(new BasicSplitPaneUI() {
        @Override
        public BasicSplitPaneDivider createDefaultDivider() {
            return new BasicSplitPaneDivider(this) {
                @Override
                public void setBorder(Border b) {
                }
            };
        }
    });
    splitP.setBorder(null);
    return splitP;
}
 
Example 10
Source File: SplitLayout.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void initialize() {

    Font buttonFont = viewSource.getFont();
    viewSource.setFont(buttonFont.deriveFont(buttonFont.getSize() / 2));
    viewSource.setPreferredSize(new Dimension(150, 15));
    viewSource.setEnabled(false);

    topLeftSPane = frame.mainFrameTree.bugListPanel();

    JPanel sourceTitlePanel = new JPanel();
    sourceTitlePanel.setLayout(new BorderLayout());

    JPanel sourcePanel = new JPanel();
    BorderLayout sourcePanelLayout = new BorderLayout();
    sourcePanelLayout.setHgap(3);
    sourcePanelLayout.setVgap(3);
    sourcePanel.setLayout(sourcePanelLayout);
    sourceTitle = new JLabel();
    sourceTitle.setText(L10N.getLocalString("txt.source_listing", ""));

    sourceTitlePanel.setBorder(new EmptyBorder(3, 3, 3, 3));
    sourceTitlePanel.add(viewSource, BorderLayout.EAST);
    sourceTitlePanel.add(sourceTitle, BorderLayout.CENTER);

    sourcePanel.setBorder(new LineBorder(Color.GRAY));
    sourcePanel.add(sourceTitlePanel, BorderLayout.NORTH);
    sourcePanel.add(frame.createSourceCodePanel(), BorderLayout.CENTER);
    sourcePanel.add(frame.createSourceSearchPanel(), BorderLayout.SOUTH);
    topSPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topLeftSPane, sourcePanel);
    topSPane.setOneTouchExpandable(true);
    topSPane.setContinuousLayout(true);
    topSPane.setDividerLocation(GUISaveState.getInstance().getSplitTop());
    removeSplitPaneBorders(topSPane);

    summarySPane = frame.summaryTab();
    mainSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSPane, summarySPane);
    mainSPane.setOneTouchExpandable(true);
    mainSPane.setContinuousLayout(true);
    mainSPane.setDividerLocation(GUISaveState.getInstance().getSplitMain());
    removeSplitPaneBorders(mainSPane);

    frame.setLayout(new BorderLayout());
    frame.add(mainSPane, BorderLayout.CENTER);
    frame.add(frame.statusBar(), BorderLayout.SOUTH);

}
 
Example 11
Source File: SourceTab.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
private void buildBottomPanel(JPanel parent, String layout, JPanel bottomPanel) {
		//parent.add(bottomPanel, layout);
		////bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
		bottomPanel.setLayout(new BorderLayout(3, 3));
		bottomPanel.setPreferredSize(new Dimension(800, 250));
		/*
		JPanel audioOpts = new JPanel();
		bottomPanel.add(audioOpts, BorderLayout.NORTH);

		rdbtnShowFFT = new JCheckBox("Show FFT");
		rdbtnShowFFT.addItemListener(this);
		rdbtnShowFFT.setSelected(true);
		audioOpts.add(rdbtnShowFFT);
		*/
		
		audioGraph = new AudioGraphPanel();
		audioGraph.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		bottomPanel.add(audioGraph, BorderLayout.CENTER);
		audioGraph.setBackground(Color.LIGHT_GRAY);
		//audioGraph.setPreferredSize(new Dimension(800, 250));
		
		if (audioGraphThread != null) { audioGraph.stopProcessing(); }		
		audioGraphThread = new Thread(audioGraph);
		audioGraphThread.setUncaughtExceptionHandler(Log.uncaughtExHandler);
		audioGraphThread.start();

		JPanel eyePhasorPanel = new JPanel();
		eyePhasorPanel.setLayout(new BorderLayout());
		
		eyePanel = new EyePanel();
		eyePanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		bottomPanel.add(eyePhasorPanel, BorderLayout.EAST);
		eyePhasorPanel.add(eyePanel, BorderLayout.WEST);
		eyePanel.setBackground(Color.LIGHT_GRAY);
		eyePanel.setPreferredSize(new Dimension(200, 100));
		eyePanel.setMaximumSize(new Dimension(200, 100));
		eyePanel.setVisible(true);
		
		phasorPanel = new PhasorPanel();
		phasorPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		eyePhasorPanel.add(phasorPanel, BorderLayout.EAST);
		phasorPanel.setBackground(Color.LIGHT_GRAY);
		phasorPanel.setPreferredSize(new Dimension(200, 100));
		phasorPanel.setMaximumSize(new Dimension(200, 100));
		phasorPanel.setVisible(false);
		
		fftPanel = new FFTPanel();
		fftPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		fftPanel.setBackground(Color.LIGHT_GRAY);
		
		//bottomPanel.add(fftPanel, BorderLayout.SOUTH);
		showFFT(false);
		fftPanel.setPreferredSize(new Dimension(100, 150));
		fftPanel.setMaximumSize(new Dimension(100, 150));
		
		splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
				bottomPanel, fftPanel);
		splitPane.setOneTouchExpandable(true);
		splitPane.setContinuousLayout(true); // repaint as we resize, otherwise we can not see the moved line against the dark background
		if (Config.splitPaneHeight != 0) 
			splitPane.setDividerLocation(Config.splitPaneHeight);
		else
			splitPane.setDividerLocation(200);
		SplitPaneUI spui = splitPane.getUI();
	    if (spui instanceof BasicSplitPaneUI) {
	      // Setting a mouse listener directly on split pane does not work, because no events are being received.
	      ((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() {
	          public void mouseReleased(MouseEvent e) {
	        	  if (Config.iq == true) {
	        		  splitPaneHeight = splitPane.getDividerLocation();
	        		  //Log.println("SplitPane: " + splitPaneHeight);
	        		  Config.splitPaneHeight = splitPaneHeight;
	        	  }
	          }
	      });
	    }
;
		
		parent.add(splitPane, layout);
		
	}
 
Example 12
Source File: UwExperimentTab.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public UwExperimentTab(FoxSpacecraft sat, int displayType)  {
	super();
	fox = sat;
	foxId = fox.foxId;
	NAME = fox.toString() + " CAN PACKETS";
	
	int j = 0;
	layout = new BitArrayLayout[ids.length];
	 for (int canid : ids)
		 layout[j++] = Config.satManager.getLayoutByCanId(6, canid);

	splitPaneHeight = Config.loadGraphIntValue(fox.getIdString(), GraphFrame.SAVED_PLOT, FoxFramePart.TYPE_REAL_TIME, UWTAB, "splitPaneHeight");
	
	lblName = new JLabel(NAME);
	lblName.setMaximumSize(new Dimension(1600, 20));
	lblName.setMinimumSize(new Dimension(1600, 20));
	lblName.setFont(new Font("SansSerif", Font.BOLD, 14));
	topPanel.add(lblName);
	
	lblFramesDecoded = new JLabel(DECODED + CAN_DECODED);
	lblFramesDecoded.setFont(new Font("SansSerif", Font.BOLD, 14));
	lblFramesDecoded.setBorder(new EmptyBorder(5, 2, 5, 5) );
	topPanel.add(lblFramesDecoded);

	healthPanel = new JPanel();
	
	healthPanel.setLayout(new BoxLayout(healthPanel, BoxLayout.Y_AXIS));
	healthPanel.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	healthPanel.setBackground(Color.DARK_GRAY);
	
	topHalfPackets = new JPanel(); 
	topHalfPackets.setBackground(Color.DARK_GRAY);
	bottomHalfPackets = new JPanel(); //new ImagePanel("C:/Users/chris.e.thompson/Desktop/workspace/SALVAGE/data/stars5.png");
	bottomHalfPackets.setBackground(Color.DARK_GRAY);
	healthPanel.add(topHalfPackets);
	healthPanel.add(bottomHalfPackets);

	initDisplayHalves(healthPanel);
	
	centerPanel = new JPanel();
	centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.X_AXIS));

	addModules();
	
	splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
			healthPanel, centerPanel);
	splitPane.setOneTouchExpandable(true);
	splitPane.setContinuousLayout(true); // repaint as we resize, otherwise we can not see the moved line against the dark background
	if (splitPaneHeight != 0) 
		splitPane.setDividerLocation(splitPaneHeight);
	else
		splitPane.setDividerLocation(DEFAULT_DIVIDER_LOCATION);
	
	SplitPaneUI spui = splitPane.getUI();
    if (spui instanceof BasicSplitPaneUI) {
      // Setting a mouse listener directly on split pane does not work, because no events are being received.
      ((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
        	  splitPaneHeight = splitPane.getDividerLocation();
        	  Log.println("SplitPane: " + splitPaneHeight);
      		Config.saveGraphIntParam(fox.getIdString(), GraphFrame.SAVED_PLOT, FoxFramePart.TYPE_REAL_TIME, UWTAB, "splitPaneHeight", splitPaneHeight);
          }
      });
    }
	//Provide minimum sizes for the two components in the split pane
	Dimension minimumSize = new Dimension(100, 50);
	healthPanel.setMinimumSize(minimumSize);
	centerPanel.setMinimumSize(minimumSize);
	add(splitPane, BorderLayout.CENTER);
			
	showRawBytes = new JCheckBox("Show Raw Bytes", Config.displayRawRadData);
	bottomPanel.add(showRawBytes );
	showRawBytes.addItemListener(this);
	

	addBottomFilter();
	
	radTableModel = new CanPacketRawTableModel();
	radPacketTableModel = new CanPacketTableModel();
	addTables(radTableModel,radPacketTableModel);

	addPacketModules();
	topHalfPackets.setVisible(false);
	bottomHalfPackets.setVisible(false);
	
	// initial populate
	parseRadiationFrames();
}
 
Example 13
Source File: TracerDataCompareView.java    From pega-tracerviewer with Apache License 2.0 4 votes vote down vote up
private JSplitPane getCompareJSplitPane() {

        TraceTable traceTableLeft = getTracerDataTableLeft();
        TraceTable traceTableRight = getTracerDataTableRight();

        // set selection model
        traceTableRight.setSelectionModel(traceTableLeft.getSelectionModel());

        TraceTableCompareMouseListener traceTableCompareMouseListener = new TraceTableCompareMouseListener(this);

        // add combined mouse listener
        traceTableCompareMouseListener.addTraceTable(traceTableLeft);
        traceTableCompareMouseListener.addTraceTable(traceTableRight);

        traceTableLeft.addMouseListener(traceTableCompareMouseListener);
        traceTableRight.addMouseListener(traceTableCompareMouseListener);

        // setup column model listener
        TableWidthColumnModelListener tableWidthColumnModelListener;
        tableWidthColumnModelListener = new TableWidthColumnModelListener();
        tableWidthColumnModelListener.addTable(traceTableLeft);
        tableWidthColumnModelListener.addTable(traceTableRight);

        traceTableLeft.getColumnModel().addColumnModelListener(tableWidthColumnModelListener);
        traceTableRight.getColumnModel().addColumnModelListener(tableWidthColumnModelListener);

        // setup JScrollBar
        JScrollPane jscrollPaneLeft = getjscrollPaneLeft();
        JScrollPane jscrollPaneRight = getjscrollPaneRight();

        JPanel traceTablePanelLeft = getSingleTableJPanel(jscrollPaneLeft, traceTableLeft, false);
        JPanel traceTablePanelRight = getSingleTableJPanel(jscrollPaneRight, traceTableRight, true);

        JSplitPane traceCompareJSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, traceTablePanelLeft,
                traceTablePanelRight);

        traceCompareJSplitPane.setContinuousLayout(true);
        // traceCompareJComponent.setDividerLocation(260);
        traceCompareJSplitPane.setResizeWeight(0.5);

        // not movable divider
        // traceCompareJSplitPane.setEnabled(false);

        return traceCompareJSplitPane;
    }
 
Example 14
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.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));
  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);
}
 
Example 15
Source File: ScoreTree.java    From libreveris with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new ScoreTree object.
 *
 * @param score the related score
 */
public ScoreTree (Score score)
{
    this.score = score;

    component = new JPanel();

    // Set up the tree
    model = new Model(score);

    ///model.addTreeModelListener(new ModelListener()); // Debug

    /** The tree entity */
    JTree tree = new JTree(model);

    // Build left-side view
    JScrollPane treeView = new JScrollPane(tree);

    // Build right-side view
    htmlPane = new JEditorPane("text/html", "");
    htmlPane.setEditable(false);

    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Allow only single selections
    tree.getSelectionModel().setSelectionMode(
            TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Display lines to explicit relationships
    tree.putClientProperty("JTree.lineStyle", "Angled");

    // Wire the two views together. Use a selection listener
    // created with an anonymous inner-class adapter.
    // Listen for when the selection changes.
    tree.addTreeSelectionListener(new SelectionListener());

    // To be notified of expansion / collapse actions (debug ...)
    ///tree.addTreeExpansionListener(new ExpansionListener());

    // Build split-pane view
    JSplitPane splitPane = new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            treeView,
            htmlView);
    splitPane.setName("treeHtmlSplitPane");
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(null);
    splitPane.setDividerSize(2);

    // Add GUI components
    component.setLayout(new BorderLayout());
    component.add("Center", splitPane);
}
 
Example 16
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 17
Source File: BookBrowser.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new {@code BookBrowser} object.
 *
 * @param book the related book
 */
public BookBrowser (Book book)
{
    this.book = book;

    component = new JPanel();

    // Set up the tree
    model = new Model(book);

    ///model.addTreeModelListener(new ModelListener()); // Debug
    /** The tree entity */
    JTree tree = new JTree(model);

    // Build left-side view
    JScrollPane treeView = new JScrollPane(tree);

    // Build right-side view
    htmlPane = new JEditorPane("text/html", "");
    htmlPane.setEditable(false);

    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Allow only single selections
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Display lines to explicit relationships
    tree.putClientProperty("JTree.lineStyle", "Angled");

    // Wire the two views together. Use a selection listener
    // created with an anonymous inner-class adapter.
    // Listen for when the selection changes.
    tree.addTreeSelectionListener(new SelectionListener());

    // To be notified of expansion / collapse actions (debug ...)
    ///tree.addTreeExpansionListener(new ExpansionListener());
    // Build split-pane view
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeView, htmlView);
    splitPane.setName("treeHtmlSplitPane");
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(null);
    splitPane.setDividerSize(2);

    // Add GUI components
    component.setLayout(new BorderLayout());
    component.add("Center", splitPane);
}
 
Example 18
Source File: Scatterplot3D.java    From chipster with MIT License 4 votes vote down vote up
@Override
public JComponent getVisualisation(DataBean data) throws Exception {

	this.data = data;

	refreshAxisBoxes(data);

	List<Variable> vars = getFrame().getVariables();
	if (vars == null || vars.size() < 4) {
		if (xBox.getItemCount() >= 1) {
			xBox.setSelectedIndex(0);
		}
		if (yBox.getItemCount() >= 2) {
			yBox.setSelectedIndex(1);
		}
		if (zBox.getItemCount() >= 3) {
			zBox.setSelectedIndex(2);
		}

		if (colorBox.getItemCount() >= 4) {
			colorBox.setSelectedIndex(3);
		}
	} else {
		xBox.setSelectedItem(vars.get(0));
		yBox.setSelectedItem(vars.get(1));
		zBox.setSelectedItem(vars.get(2));
		colorBox.setSelectedItem(vars.get(3));
	}

	List<Variable> variables = new LinkedList<Variable>();
	variables.add((Variable) xBox.getSelectedItem());
	variables.add((Variable) yBox.getSelectedItem());
	variables.add((Variable) zBox.getSelectedItem());
	variables.add((Variable) colorBox.getSelectedItem());

	if (variables.size() >= 4 && variables.get(0) != null && variables.get(1) != null && variables.get(2) != null && variables.get(3) != null) {

		retrieveData(variables);
		

		JPanel panel = new JPanel();
		panel.setLayout(new BorderLayout());

		coordinateArea = new CoordinateArea(this);
		coordinateArea.addKeyListener(this);
		coordinateArea.requestFocus();
		
		if (getDataModel().getDataArray().length > DEFAULT_TO_DOT_PAINT_MODE) {
			paintModeBox.setSelectedItem(PaintMode.RECT);
		}

		JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		split.setDividerSize(3);
		split.setOpaque(true);
		split.setRightComponent(coordinateArea);
		scalePanel = null;
		split.setLeftComponent(getColorScalePanel());
		split.setContinuousLayout(true);
		split.setDividerLocation(150);

		panel.add(split, BorderLayout.CENTER);

		coordinateArea.setCursor(ROTATE_CURSOR);
		this.setToolsEnabled(true);
		
		updateBackgroundColor();

		return panel;
	}
	return this.getDefaultVisualisation();
}
 
Example 19
Source File: VisualisationFrame.java    From chipster with MIT License 4 votes vote down vote up
public JComponent createVisualisation(VisualisationMethodChangedEvent e) {
	
	JComponent componentToReturn = null;

	try {
		// Create new visualiser only if needed to keep the settings made in settings panel
		if (this.datas != e.getDatas() || this.method != e.getNewMethod()) {
			this.datas = e.getDatas();
			this.method = e.getNewMethod();

			removeVisualiser();
			visualiser = method.getVisualiser(this);
		}
		this.variables = e.getVariables();

		// parameter panel has to be first one to make it initialised before the
		// data is set (scatterplot)
		JPanel parametersPanel = visualiser.getParameterPanel();
		logger.debug("parametersPanel for method " + method + " contains: " + parametersPanel);
		if (parametersPanel != null) {
			paramSplit = new JSplitPane();
			parametersPanel.setMinimumSize(new Dimension(0, 0));
			paramSplit.setRightComponent(parametersPanel);
			// To show the width limit of parameter panel
			paramSplit.setContinuousLayout(true);
			// To keep the parameter panel size constant
			paramSplit.setResizeWeight(1.0);

			SplitSizeHandler sizeHandler = new SplitSizeHandler();
			paramSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, sizeHandler);
		} else {
			//Do not keep references to old visualization to avoid memory leak
			if (paramSplit != null) {
				paramSplit.removeAll();
			}
		}

		JComponent visualisationComponent = null;


		if (visualiser.isForMultipleDatas()) {
			visualisationComponent = visualiser.getVisualisation(datas);
		} else if (visualiser.isForSingleData()) {
			DataBean data = datas.size() > 0 ? datas.get(0) : null;
			visualisationComponent = visualiser.getVisualisation(data);
		}

		if (parametersPanel != null) {
			paramSplit.setLeftComponent(visualisationComponent);
			componentToReturn = paramSplit;
		} else {
			componentToReturn = visualisationComponent;
		}
		
	} catch (Exception e1) {
		application.reportException(e1);
		componentToReturn = visualiser.getDefaultVisualisation();
	}

	return componentToReturn;
}
 
Example 20
Source File: EdgeSim.java    From EdgeSim with MIT License 4 votes vote down vote up
/**
 * 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());
}