List of usage examples for com.jgoodies.forms.layout CellConstraints xy
public CellConstraints xy(int col, int row)
Examples:
cc.xy(1, 1); cc.xy(1, 3);
From source file:ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutConfig.java
License:Open Source License
private void buildPanel() { initComponents();/*from w ww . jav a 2 s. c o m*/ final FormLayout layout = new FormLayout( "right:pref, 3dlu, pref:grow, 30dlu, right:pref, 3dlu, pref:grow, 3dlu,pref:grow, 30dlu, pref", "p:grow, 3dlu,p:grow, 3dlu,p:grow, 3dlu,p:grow, 3dlu, p:grow, 3dlu, p:grow, 10dlu,p:grow"); layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } }); layout.setRowGroups(new int[][] { { 3, 5, 7, 9, 11 } }); builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); final CellConstraints cc = new CellConstraints(); builder.addSeparator("General", cc.xyw(1, 1, 3)); builder.addLabel("Number", cc.xy(1, 3)); builder.add(numberTextField, cc.xy(3, 3)); builder.addLabel("Description", cc.xy(1, 5)); builder.add(descTextField, cc.xy(3, 5)); builder.addLabel("Type", cc.xy(1, 7)); builder.add(turnoutTypeComboBox, cc.xy(3, 7)); builder.addLabel("Default State", cc.xy(1, 9)); builder.add(turnoutDefaultStateComboBox, cc.xy(3, 9)); builder.addLabel("Orientation", cc.xy(1, 11)); builder.add(turnoutOrientationComboBox, cc.xy(3, 11)); builder.addSeparator("Interface", cc.xyw(5, 1, 5)); builder.addLabel("Bus 1", cc.xy(5, 3)); builder.add(bus1TextField, cc.xy(7, 3)); builder.addLabel("Address 1", cc.xy(5, 5)); builder.add(address1TextField, cc.xy(7, 5)); builder.addLabel("Bus 2", cc.xy(5, 7)); builder.add(bus2TextField, cc.xy(7, 7)); builder.addLabel("Address 2", cc.xy(5, 9)); builder.add(address2TextField, cc.xy(7, 9)); builder.add(switched1Checkbox, cc.xy(9, 5)); builder.add(switched2Checkbox, cc.xy(9, 9)); builder.addSeparator("Test", cc.xy(11, 1)); builder.add(testTurnoutWidget, cc.xywh(11, 3, 1, 9)); builder.add(errorPanel, cc.xyw(1, 13, 7)); builder.add(buildButtonBar(), cc.xyw(7, 13, 5)); add(builder.getPanel()); }
From source file:ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutGroupConfigPanel.java
License:Open Source License
private void buildPanel() { initComponents();/*from ww w. j av a 2s .c o m*/ final FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow", "p:grow, 3dlu"); final PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); final CellConstraints cc = new CellConstraints(); builder.addLabel("Name", cc.xy(1, 1)); builder.add(turnoutGroupName, cc.xy(3, 1)); add(builder.getPanel()); }
From source file:ch.thomasmueller.saltyfiles.ui.ArchivProgressDialog.java
License:Open Source License
/** * Adds the components to the panel.//from w w w . j a v a2s . c om * * @param layout * to be used * @return a layouted panel */ private JPanel build(FormLayout layout) { PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); CellConstraints cc = new CellConstraints(); builder.add(progressBar, cc.xy(2, 2)); builder.add(new JScrollPane(taskOutput), cc.xy(2, 4)); // The builder holds the layout container that we now return. return builder.getPanel(); }
From source file:ch.thomasmueller.saltyfiles.ui.MainView.java
License:Open Source License
/** * Adds the components to the panel/*from w w w . jav a 2 s . c o m*/ * @param layout to be used * @return a layouted panel */ private JPanel build(FormLayout layout) { buttonGroupEncOrDec.add(radioDecrypt); buttonGroupEncOrDec.add(radioEncrypt); buttonGroupEncOrDec.setSelected(radioEncrypt.getModel(), true); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); // Obtain a reusable constraints object to place components in the grid. CellConstraints cc = new CellConstraints(); // Fill the grid with components; the builder can create // frequently used components, e.g. separators and labels. // Add a titled separator to cell (1, 1) that spans 7 columns. builder.addSeparator("General", cc.xyw(1, 1, 9)); builder.addLabel("Mode", cc.xy(1, 3)); builder.add(radioEncrypt, cc.xy(3, 3)); builder.add(radioDecrypt, cc.xy(3, 5)); builder.addLabel("Password", cc.xy(5, 3)); builder.add(pwd, cc.xyw(7, 3, 3)); builder.addLabel("Repeat", cc.xy(5, 5)); builder.add(pwdRepeat, cc.xyw(7, 5, 3)); builder.addSeparator("Encrypt", cc.xyw(1, 7, 9)); builder.addLabel("Source Files", cc.xy(1, 9)); builder.add(textEncryptSource, cc.xyw(3, 9, 5)); builder.add(buttonChooseEncSF, cc.xy(9, 9)); builder.addLabel("Target Directory", cc.xy(1, 11)); builder.add(textEncryptTargetDir, cc.xyw(3, 11, 5)); builder.add(buttonChooseEncTD, cc.xy(9, 11)); builder.addLabel("Target Archive", cc.xy(1, 13)); builder.add(textEncryptTargetArchive, cc.xyw(3, 13, 5)); builder.addSeparator("Decrypt", cc.xyw(1, 15, 9)); builder.addLabel("Source Archive", cc.xy(1, 17)); builder.add(textDecryptSourceArchive, cc.xyw(3, 17, 5)); builder.add(buttonChooseDecSA, cc.xy(9, 17)); builder.addLabel("Target Directory", cc.xy(1, 19)); builder.add(textDecryptTargetDir, cc.xyw(3, 19, 5)); builder.add(buttonChooseDecTD, cc.xy(9, 19)); builder.addLabel("Algorithm", cc.xy(1, 23)); builder.add(chooseAlgorithm, cc.xy(3, 23)); builder.addSeparator("Transform Data", cc.xyw(1, 21, 9)); builder.add(buttonBar, cc.xyw(1, 23, 9)); // The builder holds the layout container that we now return. JPanel panel = builder.getPanel(); return panel; }
From source file:ch.zhaw.ias.dito.ui.InputPanel.java
License:BSD License
public InputPanel(HelpArea helpArea) { super(ScreenEnum.INPUT, null, ScreenEnum.QUESTION); FormLayout layout = new FormLayout( "max(30dlu; pref), 30dlu, 5dlu, max(150dlu; pref), 5dlu, max(100dlu; pref), 5dlu, max(50dlu; pref), fill:0:g", "pref, 2dlu, pref, 2dlu, pref, 10dlu, pref, 2dlu, 20dlu, 2dlu, fill:pref:grow, 2dlu, pref, 2dlu, pref, 2dlu, pref"); //layout.setRowGroups(new int[][]{{2, 4, 6}}); CellConstraints cc = new CellConstraints(); DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle()); browseButton = new JXButton(Translation.INSTANCE.get("s1.bu.browse")); filePath.setName(Translation.INSTANCE.get("s1.lb.file")); fb.addI15dSeparator("s1.title.file", cc.xyw(1, 1, 8)); fb.add(new HelpLabel(helpArea, "s1.lb.file"), cc.xyw(1, 3, 2)); fb.add(filePath, cc.xyw(4, 3, 3));//from w w w .j av a 2 s .co m fb.add(browseButton, cc.xy(8, 3)); fb.add(new HelpLabel(helpArea, "s1.lb.separator"), cc.xyw(1, 5, 2)); //fb.addI15dLabel("s1.lb.separator", cc.xyw(1, 5, 2)); fb.add(separator, cc.xy(8, 5)); fb.addI15dSeparator("s1.title.data", cc.xyw(1, 7, 8)); visualTable = new JXTable(tableModel); visualTable.setSortable(false); //visualTable.setHorizontalScrollEnabled(true); visualTable.getTableHeader().setReorderingAllowed(false); visualTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); visualTable.addHighlighter(new ColorHighlighter(new HighlightPredicate() { @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { return isColumnSelected(adapter.column) && isRowSelected(adapter.row); } }, Color.LIGHT_GRAY, Color.BLACK, Color.LIGHT_GRAY, Color.BLACK)); JScrollPane scrollPane = new JScrollPane(visualTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); rowSlider.setInverted(true); rowSlider.setOrientation(JSlider.VERTICAL); columnSlider.addChangeListener(this); rowSlider.addChangeListener(this); columnSlider.setMinimum(1); rowSlider.setMinimum(1); columnMinSpinner.addChangeListener(this); columnMaxSpinner.addChangeListener(this); rowMinSpinner.addChangeListener(this); rowMaxSpinner.addChangeListener(this); separator.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { updateTable(); } }); filePath.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { updateTable(); } }); JPanel columnSliderPanel = new JPanel(); columnSliderPanel.setLayout(new BorderLayout()); columnMinSpinner.setPreferredSize(new Dimension(50, (int) columnMinSpinner.getPreferredSize().getHeight())); columnMaxSpinner.setPreferredSize(new Dimension(50, (int) columnMaxSpinner.getPreferredSize().getHeight())); columnSliderPanel.add(columnMinSpinner, BorderLayout.WEST); columnSliderPanel.add(columnSlider, BorderLayout.CENTER); columnSliderPanel.add(columnMaxSpinner, BorderLayout.EAST); fb.add(columnSliderPanel, cc.xyw(4, 9, 6)); JPanel rowSliderPanel = new JPanel(); rowSliderPanel.setLayout(new BorderLayout()); rowSliderPanel.add(rowMinSpinner, BorderLayout.NORTH); rowSliderPanel.add(rowSlider, BorderLayout.CENTER); rowSliderPanel.add(rowMaxSpinner, BorderLayout.SOUTH); fb.add(rowSliderPanel, cc.xyw(2, 11, 1)); //set preferred size explicitly, otherwise the preferred height is too big and the screen doesn't scale its size in an appropriate way scrollPane.setPreferredSize(new Dimension(scrollPane.getWidth(), 100)); fb.add(scrollPane, cc.xyw(4, 11, 6)); fb.add(allSurveys, cc.xy(4, 13)); fb.add(allQuestions, cc.xy(4, 15)); fb.add(columnTitles, cc.xy(4, 17)); //validationGroup.add(filePath, Validators.FILE_MUST_BE_FILE, Validators.FILE_MUST_EXIST); //validationGroup.add(separator, Validators.REQUIRE_NON_EMPTY_STRING); Input i = Config.INSTANCE.getDitoConfig().getInput(); filePath.setText(i.getFilename()); separator.setText(Character.toString(i.getSeparator())); allQuestions.addChangeListener(this); allSurveys.addChangeListener(this); columnTitles.addChangeListener(this); allQuestions.setSelected(i.isAllQuestions()); allSurveys.setSelected(i.isAllSurveys()); columnTitles.setSelected(i.isQuestionTitles()); browseButton.addActionListener(this); this.setLayout(new BorderLayout()); this.add(fb.getPanel(), BorderLayout.CENTER); updateTable(); columnSlider.setValue(i.getStartQuestion()); columnSlider.setUpperValue(i.getEndQuestion()); rowSlider.setValue(i.getStartSurvey()); rowSlider.setUpperValue(i.getEndSurvey()); }
From source file:ch.zhaw.ias.dito.ui.MainFrame.java
License:BSD License
public MainFrame(String filename) { if (filename != null) { try {/*w w w.ja v a 2s.c om*/ DitoConfiguration config = DitoConfiguration.loadFromFile(filename); config.setLocation(filename); config.loadMatrix(); Config.INSTANCE.setDitoConfig(config); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { Config.INSTANCE.setDitoConfig(DitoConfiguration.createEmpty()); } FormLayout layout = new FormLayout("2dlu, 150dlu, 2dlu, pref:grow, 2dlu", "2dlu, fill:75dlu, 2dlu, fill:pref:grow, 2dlu"); CellConstraints cc = new CellConstraints(); this.getContentPane().setLayout(layout); toolbarPanel = new ToolbarPanel(this); this.add(toolbarPanel, cc.xy(2, 2)); this.add(helpPanel, cc.xy(4, 2)); this.add(processPanel, cc.xy(2, 4)); this.add(mainPanel, cc.xy(4, 4)); this.setTitle(Translation.INSTANCE.get("misc.title") + " (build #" + AppConfig.BUILD_NUMBER + " built on " + AppConfig.BUILD_DATE + ")"); this.setSize(1200, 1000); this.setDefaultCloseOperation(JXFrame.EXIT_ON_CLOSE); this.setVisible(true); switchTo(ScreenEnum.INPUT); //save before closing? this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { toolbarPanel.checkSave(); } }); }
From source file:ch.zhaw.ias.dito.ui.MainPanel.java
License:BSD License
public MainPanel(MainFrame mainFrame) { this.mainFrame = mainFrame; //setTitle(Translation.INSTANCE.get("main.main")); setBorder(BorderFactory.createEtchedBorder()); FormLayout layout = new FormLayout("fill:20dlu, fill:0:grow, fill:20dlu", "20dlu, fill:min:grow(0.8), fill:0:grow(0.2), fill:20dlu"); //layout.setRowGroups(new int[][]{{2, 4, 6}}); CellConstraints cc = new CellConstraints(); //DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle(), new FormDebugPanel()); JXPanel buttonPanel = new JXPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); nextButton.setPreferredSize(new Dimension(100, 25)); previousButton.setPreferredSize(new Dimension(100, 25)); buttonPanel.add(previousButton);/*from w ww. j av a 2 s.c om*/ buttonPanel.add(nextButton); validationPanel.addChangeListener(this); this.setLayout(layout); this.add(validationPanel, cc.xy(2, 2)); this.add(buttonPanel, cc.xy(2, 4)); nextButton.addActionListener(this); previousButton.addActionListener(this); }
From source file:ch.zhaw.ias.dito.ui.MethodPanel.java
License:BSD License
public MethodPanel(HelpArea helpArea) { super(ScreenEnum.METHOD, ScreenEnum.QUESTION, ScreenEnum.ANALYSIS); comboModel = new MethodComboModel(DistanceMethodEnum.get(Coding.REAL)); methods = new JComboBox(comboModel); FormLayout layout = new FormLayout( "pref, 5dlu, max(100dlu; pref), 5dlu, max(100dlu; pref), 5dlu, max(100dlu; pref), pref:grow", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, fill:pref:grow"); CellConstraints cc = new CellConstraints(); DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle()); fb.addI15dSeparator("s3.lb.method", cc.xyw(1, 1, 5)); fb.addI15dLabel("s3.lb.coding", cc.xyw(1, 3, 3)); fb.add(codingGroup, cc.xy(5, 3)); codingGroup.addActionListener(this); fb.addI15dLabel("s3.lb.distance", cc.xyw(1, 5, 3)); fb.add(methods, cc.xy(5, 5));/*from w w w . j a va2s . co m*/ methods.addActionListener(this); fb.addI15dLabel("s3.lb.parameter", cc.xyw(1, 7, 3)); fb.add(parameter, cc.xy(5, 7)); fb.add(formula, cc.xywh(7, 3, 1, 5)); fb.add(ownDefinition, cc.xyw(1, 9, 3)); createDefinition.setText("(a+d)/(a+b+c+d)"); fb.add(createDefinition, cc.xy(5, 9)); plotButton.addActionListener(this); fb.add(plotButton, cc.xy(5, 11)); fb.addI15dSeparator("s3.lb.calculation", cc.xyw(1, 13, 5)); fb.add(randomSample, cc.xyw(1, 15, 5)); fb.addI15dLabel("s3.lb.sampleSize", cc.xy(3, 17)); fb.add(sampleSize, cc.xy(5, 17)); fb.add(parallel, cc.xyw(1, 19, 5)); fb.addI15dLabel("s3.lb.numberOfThreads", cc.xy(3, 21)); fb.add(numberOfThreads, cc.xy(5, 21)); Method m = Config.INSTANCE.getDitoConfig().getMethod(); codingGroup.setSelectedValue(m.getMethod().getCoding()); methods.setSelectedItem(DistanceMethodEnum.get(m.getName())); randomSample.setSelected(m.isUseRandomSample()); randomSample.addActionListener(this); sampleSize.setText(Integer.toString(m.getSampleSize())); parallel.setSelected(m.isParallel()); parallel.addActionListener(this); numberOfThreads.setText(Integer.toString(m.getNumberOfThreads())); this.setLayout(new BorderLayout()); this.add(fb.getPanel(), BorderLayout.CENTER); //set distance matrix to null. this way it can be garbage collected //the distance matrix is probably quite large, and the calculations will need a lot of memory Config.INSTANCE.setDistanceMatrix(null); updateEnabling(); }
From source file:ch.zhaw.ias.dito.ui.OutputPanel.java
License:BSD License
public OutputPanel(HelpArea helpArea) { super(ScreenEnum.OUTPUT, ScreenEnum.ANALYSIS, null); FormLayout layout = new FormLayout( "max(50dlu; pref), 5dlu, max(100dlu; pref), 5dlu, max(50dlu; pref), 5dlu, max(100dlu; pref), 5dlu, max(50dlu; pref)", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref"); //layout.setRowGroups(new int[][]{{2, 4, 6}}); CellConstraints cc = new CellConstraints(); DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle()); browseButton = new JXButton(Translation.INSTANCE.get("s1.bu.browse")); filePath.setName(Translation.INSTANCE.get("s1.lb.file")); fb.addI15dSeparator("s5.title.file", cc.xyw(1, 1, 9)); fb.addI15dLabel("s1.lb.file", cc.xy(1, 3)); fb.add(filePath, cc.xyw(3, 3, 5));//from w ww . java2 s . com fb.add(browseButton, cc.xy(9, 3)); fb.addI15dLabel("s1.lb.separator", cc.xy(1, 5)); fb.add(separator, cc.xy(7, 5)); fb.addI15dLabel("s5.lb.precision", cc.xy(1, 7)); fb.add(precision, cc.xy(7, 7)); fb.add(saveButton, cc.xy(7, 9)); //validationGroup.add(filePath, Validators.fFILE_MUST_BE_FILE); //validationGroup.add(separator, Validators.REQUIRE_NON_EMPTY_STRING); Output o = Config.INSTANCE.getDitoConfig().getOutput(); filePath.setText(o.getFilename()); separator.setText(Character.toString(o.getSeparator())); precision.setText(Integer.toString(o.getPrecision())); browseButton.addActionListener(this); saveButton.addActionListener(this); this.setLayout(new BorderLayout()); this.add(fb.getPanel(), BorderLayout.CENTER); }
From source file:ch.zhaw.ias.dito.ui.ProcessPanel.java
License:BSD License
public ProcessPanel() { setBorder(BorderFactory.createEtchedBorder()); FormLayout layout = new FormLayout("5dlu, 50dlu:grow, 5dlu", "5dlu, fill:pref, fill:pref:grow, fill:pref, fill:pref:grow, fill:pref, fill:pref:grow, fill:pref, fill:pref:grow, fill:pref, 5dlu, fill:20dlu, 5dlu, fill:8dlu, 5dlu"); int[][] rowGroups = new int[][] { { 2, 4, 6, 8 }, { 3, 5, 7 } }; layout.setRowGroups(rowGroups);/* w w w . j ava 2 s. c o m*/ CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(layout); panels.put(ScreenEnum.INPUT, new ProcessStepPanel(ScreenEnum.INPUT, ConfigProperty.INPUT_FILENAME, ConfigProperty.INPUT_SIZE)); panels.put(ScreenEnum.QUESTION, new ProcessStepPanel(ScreenEnum.QUESTION, ConfigProperty.QUESTION_NUMBER)); panels.put(ScreenEnum.METHOD, new ProcessStepPanel(ScreenEnum.METHOD, ConfigProperty.METHOD_NAME, ConfigProperty.RANDOM_SAMPLE)); panels.put(ScreenEnum.ANALYSIS, new ProcessStepPanel(ScreenEnum.ANALYSIS)); panels.put(ScreenEnum.OUTPUT, new ProcessStepPanel(ScreenEnum.OUTPUT, ConfigProperty.OUTPUT_FILENAME, ConfigProperty.OUTPUT_PRECISION)); pb.add(panels.get(ScreenEnum.INPUT), cc.xy(2, 2)); pb.add(new ArrowPanel(), cc.xy(2, 3)); pb.add(panels.get(ScreenEnum.QUESTION), cc.xy(2, 4)); pb.add(new ArrowPanel(), cc.xy(2, 5)); pb.add(panels.get(ScreenEnum.METHOD), cc.xy(2, 6)); pb.add(new ArrowPanel(), cc.xy(2, 7)); pb.add(panels.get(ScreenEnum.ANALYSIS), cc.xy(2, 8)); pb.add(new ArrowPanel(), cc.xy(2, 9)); pb.add(panels.get(ScreenEnum.OUTPUT), cc.xy(2, 10)); pb.add(progress, cc.xy(2, 12)); pb.add(status, cc.xy(2, 14)); this.setLayout(new BorderLayout()); add(pb.getPanel(), BorderLayout.CENTER); Logger.INSTANCE.addInterface(this); }