List of usage examples for com.jgoodies.forms.layout CellConstraints xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan, String encodedAlignments)
Examples:
cc.xywh(1, 3, 2, 1, "left, bottom"); cc.xywh(1, 3, 2, 1, "l, b"); cc.xywh(1, 3, 7, 3, "center, fill"); cc.xywh(1, 3, 7, 3, "c, f");
From source file:loci.visbio.BioTask.java
License:Open Source License
/** Constructs a new VisBio task. */ public BioTask(final TaskManager taskMan, final String name) { tm = taskMan;//from ww w . j a va 2s. c o m title = new JLabel(name); title.setFont(title.getFont().deriveFont(Font.BOLD)); status = new JLabel() { @Override public Dimension getPreferredSize() { // HACK - limit label width to viewport final Dimension pref = super.getPreferredSize(); int width = tm.getControls().getPreferredTaskWidth() - title.getPreferredSize().width - stop.getPreferredSize().width - 25; if (pref.width < width) width = pref.width; return new Dimension(width, pref.height); } }; progress = new JProgressBar(); progress.setIndeterminate(true); stop = new JButton("Stop"); stop.addActionListener(this); stop.setEnabled(false); setLayout(new BorderLayout()); setBorder(new EmptyBorder(0, 0, 5, 0)); final PanelBuilder builder = new PanelBuilder( new FormLayout("pref:grow, 3dlu, pref:grow, 3dlu, pref", "pref, pref")); final CellConstraints cc = new CellConstraints(); builder.add(title, cc.xy(1, 1, "left,bottom")); builder.add(status, cc.xy(3, 1, "right,bottom")); builder.add(progress, cc.xyw(1, 2, 3, "fill,top")); builder.add(stop, cc.xywh(5, 1, 1, 2, "center,center")); add(builder.getPanel()); }
From source file:loci.visbio.PanelManager.java
License:Open Source License
/** Called to notify the logic manager of a VisBio event. */ @Override/*from w w w . ja v a 2 s . co m*/ public void doEvent(final VisBioEvent evt) { final int eventType = evt.getEventType(); if (eventType == VisBioEvent.LOGIC_ADDED) { final Object src = evt.getSource(); if (src == this) doGUI(); else if (src instanceof ExitManager) { // HACK - finalize control panel layout bio.setSplashStatus("Initializing control panels"); // lay out control panels final String pad = "9dlu"; final String[] cols = new String[numCols]; final String[] rows = new String[numRows]; Arrays.fill(cols, pad); Arrays.fill(rows, pad); for (int i = 0; i < panels.size(); i++) { final ControlPanel cpl = (ControlPanel) panels.elementAt(i); final Point p = (Point) coords.elementAt(i); final Dimension d = (Dimension) sizes.elementAt(i); final int xx = p.x; final int yy = p.y; final int ww = d.width; final int hh = d.height; final String colString = (String) colStrings.elementAt(i); final String rowString = (String) rowStrings.elementAt(i); cols[xx - 1] = colString; rows[yy - 1] = "pref"; rows[yy] = "3dlu"; rows[yy + 1] = rowString; } final StringBuffer cbuf = new StringBuffer(cols[0]); for (int i = 1; i < cols.length; i++) { cbuf.append(","); cbuf.append(cols[i]); } final StringBuffer rbuf = new StringBuffer(rows[0]); for (int i = 1; i < rows.length; i++) { rbuf.append(","); rbuf.append(rows[i]); } final PanelBuilder builder = new PanelBuilder(new FormLayout(cbuf.toString(), rbuf.toString())); builder.setDefaultDialogBorder(); final CellConstraints cc = new CellConstraints(); for (int i = 0; i < panels.size(); i++) { final ControlPanel cpl = (ControlPanel) panels.elementAt(i); final Point p = (Point) coords.elementAt(i); final Dimension d = (Dimension) sizes.elementAt(i); final int xx = p.x; final int yy = p.y; final int ww = d.width; final int hh = d.height; builder.addSeparator(cpl.getName(), cc.xyw(xx, yy, ww)); builder.add(cpl, cc.xywh(xx, yy + 2, ww, hh, "fill,fill")); } bio.setContentPane(builder.getPanel()); } } }