List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
From source file:gtu.zcognos.DimensionUI.java
private void initGUI() { try {/*from w w w. j a v a2 s .c o m*/ final SwingActionUtil swingUtil = (SwingActionUtil) SwingActionUtil.newInstance(this); { GroupLayout thisLayout = new GroupLayout((JComponent) getContentPane()); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); { projectId = new JTextField(); } { jLabel1 = new JLabel(); jLabel1.setText("PROJECT_ID"); } { create = new JButton(); create.setText("create"); create.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("create.actionPerformed", evt); } }); } { reportId = new JTextField(); } { jLabel8 = new JLabel(); jLabel8.setText("report id"); } { addDimensionFromDb = new JButton(); addDimensionFromDb.setText("add from db"); addDimensionFromDb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("addFromDb.actionPerformed", evt); } }); } { dataSourceTable = new JTextField(); dataSourceTable.setText("rscdpg0901"); } { jLabel7 = new JLabel(); jLabel7.setText("data source table"); } { addDimension = new JButton(); addDimension.setText("add"); addDimension.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("add.actionPerformed", evt); } }); } { dimensionName = new JTextField(); } { jLabel6 = new JLabel(); jLabel6.setText("dimension chinese name"); } { jLabel5 = new JLabel(); jLabel5.setText("rscdzzzz id index"); } { String[] idx = new String[20]; for (int ii = 0; ii < idx.length; ii++) { idx[ii] = "id" + (ii + 1); } ComboBoxModel rscdzzzzIdIndexModel = new DefaultComboBoxModel(idx); rscdzzzzIdIndex = new JComboBox(); rscdzzzzIdIndex.setModel(rscdzzzzIdIndexModel); } { jLabel3 = new JLabel(); jLabel3.setText("Dimension"); } { jScrollPane1 = new JScrollPane(); { DefaultListModel dimensionListModel = new DefaultListModel(); dimensionList = new JList(); jScrollPane1.setViewportView(dimensionList); dimensionList.setModel(dimensionListModel); dimensionList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(dimensionList).defaultJListKeyPressed(evt); } }); } } { exportDir = new JButton(); exportDir.setText("export dir"); exportDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("exportDir.actionPerformed", evt); } }); } { category = new JTextField(); } { jLabel4 = new JLabel(); jLabel4.setText("category"); } { tableName = new JTextField(); } { jLabel2 = new JLabel(); jLabel2.setText("merge table name"); } thisLayout .setHorizontalGroup(thisLayout.createSequentialGroup().addContainerGap(12, 12) .addGroup(thisLayout.createParallelGroup() .addComponent(jLabel3, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addGroup(thisLayout.createSequentialGroup().addGap(19).addGroup(thisLayout .createParallelGroup().addGroup(thisLayout.createSequentialGroup() .addComponent(exportDir, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent( addDimension, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup().addComponent( addDimensionFromDb, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE) .addGroup(thisLayout.createSequentialGroup().addGap( 88) .addComponent(create, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE)))) .addGroup(thisLayout.createSequentialGroup().addGroup(thisLayout .createParallelGroup() .addComponent(jLabel6, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE)) .addGap(39) .addGroup(thisLayout.createParallelGroup() .addComponent(dimensionName, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(rscdzzzzIdIndex, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(category, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(reportId, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(tableName, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(dataSourceTable, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE) .addComponent(projectId, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE))) .addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 436, GroupLayout.PREFERRED_SIZE)))) .addContainerGap(11, 11)); thisLayout.setVerticalGroup(thisLayout.createSequentialGroup().addContainerGap(12, 12) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(projectId, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(dataSourceTable, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(tableName, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(reportId, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(category, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup() .addComponent(jLabel5, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(rscdzzzzIdIndex, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(dimensionName, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(addDimension, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(exportDir, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(addDimensionFromDb, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 269, GroupLayout.PREFERRED_SIZE) .addGap(12).addComponent(create, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(9, 9)); } this.setSize(513, 632); swingUtil.addAction("exportDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file != null) { baseDir = file; } } }); swingUtil.addAction("addFromDb.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { String project = projectId.getText(); Validate.notEmpty(project, "projectId is null"); Validate.notEmpty(dataSourceTable.getText(), "dataSourceTable is null"); DefaultListModel model = (DefaultListModel) dimensionList.getModel(); for (Dimension_ ddd : InformixDbConn.queryGetDaminsion(dataSourceTable.getText(), project)) { model.addElement(ddd); } } }); swingUtil.addAction("add.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { // Validate.notEmpty(tableName.getText(), // "tableName is null"); Validate.notEmpty(category.getText(), "category is null"); Validate.notEmpty(dimensionName.getText(), "dimensionName is null"); Validate.notEmpty(dataSourceTable.getText(), "dataSourceTable is null"); // Validate.notEmpty(reportId.getText(), // "reportId is null"); String report_id = StringUtils.defaultString(reportId.getText(), projectId.getText()); String tName = tableName.getText(); if (StringUtils.isEmpty(tName)) { tName = randomTableName(); } DefaultListModel model = (DefaultListModel) dimensionList.getModel(); model.addElement(new Dimension_(dataSourceTable.getText(), tName, category.getText(), (String) rscdzzzzIdIndex.getSelectedItem(), dimensionName.getText(), report_id)); } }); swingUtil.addAction("create.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { String project = projectId.getText(); Validate.notEmpty(project, "projectId is null"); Validate.notNull(baseDir, "exportDir is null"); File destDir = new File(baseDir, project); Map<String, Object> map = new HashMap<String, Object>(); List<Map<String, String>> llist = new ArrayList<Map<String, String>>(); int idx = 2; int categoryId = 1; DefaultListModel model = (DefaultListModel) dimensionList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { Dimension_ di = (Dimension_) enu.nextElement(); Map mmm = new HashMap(); mmm.put("rscdpg0901", di.dataSourceTable);// mmm.put("rscdpg0901a", di.tableName);// mmm.put("rscdpg0901a_category", di.category);// mmm.put("rscdpg0901a_report_id", di.reportId);// mmm.put("rscdzzzz_id", di.idIndex);// mmm.put("rscdpg0901a_dname", di.dimensionName);// llist.add(mmm); } map.put("PROJECT_ID", project); map.put("RSCDPG0901", llist); map.put("rscdpg0901", dataSourceTable.getText()); ConfigCopy.getInstance().applyBaseDir(baseDir).applyProjectId(project).execute(); Dimension.getInstance()// .applyDestDir(destDir.getAbsolutePath())// .applyParameter(map)// .execute(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog(project + " create completed!!\r\n dir : " // + destDir.getAbsolutePath(), project); Desktop.getDesktop().open(destDir); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:qmod.generator.MainWindow.java
@SuppressWarnings("unchecked") public MainWindow() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Quick Mod Generator"); JLabel lblAuthors = new JLabel("Authors:"); authorField1 = new JTextField(); authorField1.setColumns(25);//from w ww.j a v a 2s.co m JButton btnGenerateFile = new JButton("Generate File"); btnGenerateFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { writeFiles(); } }); authCombo1.setFont(new Font("Dialog", Font.BOLD, 8)); authCombo1.setModel( (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" })); authCombo1.setSelectedIndex(0); authCombo2.setFont(new Font("Dialog", Font.BOLD, 8)); authCombo2.setModel( (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" })); authCombo2.setSelectedIndex(0); authorField2 = new JTextField(); authorField2.setColumns(25); authCombo3.setFont(new Font("Dialog", Font.BOLD, 8)); authCombo3.setModel( (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" })); authCombo3.setSelectedIndex(0); authorField3 = new JTextField(); authorField3.setColumns(25); JLabel lblCategories = new JLabel("Categories:"); categoriesField = new JTextField(); categoriesField.setColumns(10); JLabel lblDescription = new JLabel("Description:"); JEditorPane descriptionField = new JEditorPane(); JLabel lblLicense = new JLabel("License:"); licenseField = new JTextField(); licenseField.setColumns(10); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createParallelGroup(Alignment.TRAILING).addComponent(btnGenerateFile) .addGroup(groupLayout.createSequentialGroup().addComponent(lblAuthors) .addPreferredGap(ComponentPlacement.RELATED).addGroup(groupLayout .createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup() .addComponent( authCombo2, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addGap(6).addComponent(authorField2, GroupLayout.PREFERRED_SIZE, 192, GroupLayout.PREFERRED_SIZE)) .addGroup(groupLayout.createSequentialGroup().addComponent( authCombo1, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE).addPreferredGap( ComponentPlacement.RELATED) .addComponent( authorField1, GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)) .addGroup(groupLayout.createSequentialGroup() .addComponent(authCombo3, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addGap(6).addGroup(groupLayout.createParallelGroup( Alignment.LEADING).addComponent( descriptionField) .addGroup(groupLayout .createParallelGroup( Alignment.LEADING, false) .addComponent(categoriesField) .addComponent( authorField3, GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)) .addGroup(groupLayout .createSequentialGroup() .addComponent(licenseField, GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE) .addPreferredGap( ComponentPlacement.RELATED))))))) .addComponent(lblCategories).addComponent(lblDescription)) .addGap(84)) .addGroup(groupLayout.createSequentialGroup().addComponent(lblLicense) .addContainerGap(377, Short.MAX_VALUE))))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblAuthors) .addComponent(authorField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(authCombo1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(authCombo2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(groupLayout.createSequentialGroup().addGap(3).addComponent(authorField2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(authCombo3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(groupLayout.createSequentialGroup().addGap(3).addComponent(authorField3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblCategories) .addComponent(categoriesField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblDescription) .addComponent(descriptionField, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addGap(9).addComponent(lblLicense)) .addGroup(groupLayout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED) .addComponent(licenseField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED, 322, Short.MAX_VALUE).addComponent(btnGenerateFile) .addContainerGap())); getContentPane().setLayout(groupLayout); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); mnFile.setMnemonic('F'); menuBar.add(mnFile); JMenuItem mntmNew = new JMenuItem("New"); mntmNew.setMnemonic(KeyEvent.VK_N); mnFile.add(mntmNew); JMenuItem mntmOpen = new JMenuItem("Open"); mnFile.add(mntmOpen); JMenuItem mntmSave = new JMenuItem("Save"); mnFile.add(mntmSave); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); mntmExit.setMnemonic(KeyEvent.VK_X); mnFile.add(mntmExit); }
From source file:components.TextAreaDemo.java
private void initComponents() { jLabel1 = new JLabel("Try typing 'spectacular' or 'Swing'..."); textArea = new JTextArea(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); textArea.setColumns(20);//from ww w .jav a2 s . c o m textArea.setLineWrap(true); textArea.setRows(5); textArea.setWrapStyleWord(true); jScrollPane1 = new JScrollPane(textArea); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); //Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); //Add a scroll panel and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); h2.addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); //Add a container gap to the sequential group h1 h1.addContainerGap(); // Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); //Add the group h1 to hGroup hGroup.addGroup(Alignment.TRAILING, h1); //Create the horizontal group layout.setHorizontalGroup(hGroup); //Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential group SequentialGroup v1 = layout.createSequentialGroup(); //Add a container gap to the sequential group v1 v1.addContainerGap(); //Add a label to the sequential group v1 v1.addComponent(jLabel1); v1.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); //Add scroll panel to the sequential group v1 v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE); v1.addContainerGap(); //Add the group v1 to vGroup vGroup.addGroup(v1); //Create the vertical group layout.setVerticalGroup(vGroup); pack(); }
From source file:com.pos.spatobiz.app.view.karyawan.DataKaryawan.java
/** This method is called from within the constructor to * initialize the form./*ww w. j av a2 s. c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { whiteLabel1 = new WhiteLabel(); textSaring = new TextBoxTransfer(); table = new Table(); whiteLabel1.setText("Saring :"); whiteLabel1.setName("whiteLabel1"); // NOI18N textSaring.setName("textSaring"); // NOI18N table.setName("table"); // NOI18N GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addComponent(table, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 664, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(whiteLabel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textSaring, GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(whiteLabel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textSaring, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(table, GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE).addContainerGap())); }
From source file:au.org.ala.delta.intkey.ui.WebSearchDialog.java
/** * Create the dialog./*from w w w . ja va2s. c o m*/ */ public WebSearchDialog(Dialog owner) { super(owner); setName("WebSearchDialog"); ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(WebSearchDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(WebSearchDialog.class, this); setTitle(websearchTitle); setBounds(100, 100, 450, 250); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); { lblSearchFor = new JLabel(searchForLabel); } txtSearch = new JTextField(); txtSearch.setColumns(10); final JLabel lblUsing = new JLabel(usingLabel); cmbSearchEngine = new JComboBox(); GroupLayout gl_contentPanel = new GroupLayout(contentPanel); gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap() .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addComponent(lblSearchFor, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(cmbSearchEngine, 0, 404, Short.MAX_VALUE) .addComponent(txtSearch, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(lblUsing, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)) .addContainerGap())); gl_contentPanel .setVerticalGroup( gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap() .addComponent(lblSearchFor).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(txtSearch, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(27).addComponent(lblUsing) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(cmbSearchEngine, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(41, Short.MAX_VALUE))); contentPanel.setLayout(gl_contentPanel); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("[OK]"); okButton.setAction(actionMap.get("WebSearchDialog_search")); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("[Cancel]"); cancelButton.setAction(actionMap.get("WebSearchDialog_cancel")); buttonPane.add(cancelButton); } } LocalConfigFiles files = new LocalConfigFiles("intkey"); File f = files.getWebsearchIndexFile(); if (f.exists()) { loadSearchEngines(f, cmbSearchEngine); } cmbSearchEngine.requestFocus(); }
From source file:volker.streaming.music.gui.ApiPanel.java
private void initComponents() { URL onUrl = getClass().getResource("on.png"); onIcon = getIcon(onUrl);//from w w w .ja v a 2 s .c o m URL offUrl = getClass().getResource("off.png"); offIcon = getIcon(offUrl); statusButton = new JButton(); statusLabel = new JLabel("Start/Stop:"); stateLabel = new JLabel(status.get() ? RUNNING : STOPPED); iconBorder = BorderFactory.createEmptyBorder(); textBorder = statusButton.getBorder(); statusButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { synchronized (status) { // status is only set here status.set(!status.get()); } showUpdatedStatus(); } }); showUpdatedStatus(); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(statusLabel, GroupLayout.Alignment.CENTER) .addComponent(statusButton, GroupLayout.Alignment.CENTER) .addComponent(stateLabel, GroupLayout.Alignment.CENTER)) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap().addComponent(statusLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(statusButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(stateLabel) .addContainerGap()); }
From source file:org.xapagy.ui.tempdyn.GraphEvolution.java
/** * Generates the graph which plots the three choice scores (independent, * dependent and mood) for the evolution of a choice in time. * //from w w w .ja v a 2s. c o m * @param tdc * - encompasses the selected choice * @param database * - the database of values collected * @param agent * @param index * - a list of time points which will be plotted on the x axis * @param choiceRange * - the y axis will be [0, choiceRange] */ public static void graphChoiceEvolution(tdComponent tdc, tdDataBase database, Agent agent, List<Double> index, double choiceRange) { String label = PpChoice.ppConcise(tdc.getChoice(), agent); // create a general purpose xy collection for jfreechart XYSeriesCollection xysc = new XYSeriesCollection(); // focus and memory xysc.addSeries(new XYSeries("ChoiceScoreIndependent")); xysc.addSeries(new XYSeries("ChoiceScoreDependent")); xysc.addSeries(new XYSeries("ChoiceScoreMood")); // Fill in the values for (Double time : index) { double dtime = time; double valueChoiceScoreIndependent = database.getChoiceScoreDependent(tdc.getIdentifier(), time); xysc.getSeries("ChoiceScoreIndependent").add(dtime, valueChoiceScoreIndependent); double valueChoiceScoreDependent = database.getChoiceScoreDependent(tdc.getIdentifier(), time); xysc.getSeries("ChoiceScoreDependent").add(dtime, valueChoiceScoreDependent); double valueChoiceScoreMood = database.getChoiceScoreDependent(tdc.getIdentifier(), time); xysc.getSeries("ChoiceScoreMood").add(dtime, valueChoiceScoreMood); } // // ok, now let us create a graph // JPanel panel = new JPanel(); // create a layout GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup sgv = layout.createSequentialGroup(); layout.setVerticalGroup(sgv); ParallelGroup pgh = layout.createParallelGroup(); layout.setHorizontalGroup(pgh); // // the graph with the focus and the memory // XYSeriesCollection xysFM = new XYSeriesCollection(); xysFM.addSeries(xysc.getSeries("ChoiceScoreIndependent")); xysFM.addSeries(xysc.getSeries("ChoiceScoreDependent")); xysFM.addSeries(xysc.getSeries("ChoiceScoreMood")); JFreeChart chart = ChartFactory.createXYLineChart(label + " - Choice", "Time", "Value", xysFM, PlotOrientation.VERTICAL, true, false, false); GraphEvolution.setChartProperties(chart, GraphEvolution.lineStylesColorful); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); JFrame frame = new JFrame(); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:com.cactus.ClientLoginGUI.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* w w w . j a va2s . c om*/ */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { this.pack(); this.setLocationRelativeTo(null); Username_TextField = new JTextField(); Password_TextField = new JPasswordField(); Username_Label = new JLabel(); Password_label = new JLabel(); Login_Button = new JButton(); Register_Button = new JButton(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Username_TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Username_TextFieldActionPerformed(evt); } }); Password_TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Password_TextFieldActionPerformed(evt); } }); Username_Label.setText("Username:"); Password_label.setText("Password:"); Login_Button.setText("Login"); Login_Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { Login_ButtonActionPerformed(evt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); Register_Button.setText("Register"); Register_Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { Register_ButtonActionPerformed(evt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); javax.swing.GroupLayout layout = new GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(101) .addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(Password_label) .addComponent(Username_TextField) .addComponent(Password_TextField, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(Register_Button) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Login_Button)) .addComponent(Username_Label, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)) .addContainerGap(128, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(71).addComponent(Username_Label) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(Username_TextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(27).addComponent(Password_label).addPreferredGap(ComponentPlacement.RELATED) .addComponent(Password_TextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(33).addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(Register_Button).addComponent(Login_Button)) .addContainerGap(48, Short.MAX_VALUE))); getContentPane().setLayout(layout); pack(); }
From source file:TextAreaDemo.java
private void initComponents() { jLabel1 = new JLabel("Try typing 'spectacular' or 'Swing'..."); textArea = new JTextArea(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); textArea.setColumns(20);//from w w w .j av a 2 s . co m textArea.setLineWrap(true); textArea.setRows(5); textArea.setWrapStyleWord(true); jScrollPane1 = new JScrollPane(textArea); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); // Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); // Add a scroll panel and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); h2.addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); // Add a container gap to the sequential group h1 h1.addContainerGap(); // Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); // Add the group h1 to hGroup hGroup.addGroup(Alignment.TRAILING, h1); // Create the horizontal group layout.setHorizontalGroup(hGroup); // Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential group SequentialGroup v1 = layout.createSequentialGroup(); // Add a container gap to the sequential group v1 v1.addContainerGap(); // Add a label to the sequential group v1 v1.addComponent(jLabel1); v1.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); // Add scroll panel to the sequential group v1 v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE); v1.addContainerGap(); // Add the group v1 to vGroup vGroup.addGroup(v1); // Create the vertical group layout.setVerticalGroup(vGroup); pack(); }
From source file:FormularioGuardarEstudio.java
@SuppressWarnings({ "unchecked", "rawtypes" }) private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - verdura henrion label1 = new JLabel(); pacientesCombo = new JComboBox(obtenerPacientes().toArray()); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); nombreEstudio = new JTextField(); scrollPane1 = new JScrollPane(); descripcion = new JTextArea(); descripcion.setLineWrap(true);/*from w w w . j a v a 2s. c o m*/ descripcion.setWrapStyleWord(true); notas = new JTextArea(); notas.setLineWrap(true); notas.setWrapStyleWord(true); button1 = new JButton(); mensajeRespuesta = new JLabel(); //======== this ======== setTitle("Guardar Estudio"); Container contentPane = getContentPane(); //---- label1 ---- label1.setText("Paciente:"); label1.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label2 ---- label2.setText("Datos del Estudio"); label2.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label3 ---- label3.setText("Nombre Del Estudio:"); //---- label4 ---- label4.setText("Descripci\u00f3n:"); //---- label5 ---- label5.setText("Notas:"); //======== scrollPane1 ======== { scrollPane1.setViewportView(descripcion); } //---- button1 ---- button1.setText("Guardar Estudio"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clickGuardarEstudio(e); } }); //---- mensajeRespuesta ---- mensajeRespuesta.setText("_"); mensajeRespuesta.setHorizontalAlignment(SwingConstants.CENTER); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup() .addContainerGap().addGroup(contentPaneLayout.createParallelGroup().addComponent(label4) .addComponent(label1, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) .addComponent( pacientesCombo, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE) .addComponent(label2) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label3) .addGap(18, 18, 18).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label5) .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup().addGap(83, 83, 83) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addComponent(notas, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))) .addGroup(contentPaneLayout.createSequentialGroup() .addGap(48, 48, 48).addComponent(mensajeRespuesta, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)))))) .addGroup(contentPaneLayout.createSequentialGroup().addGap(142, 142, 142) .addComponent(button1))) .addContainerGap(18, Short.MAX_VALUE))); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(label1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pacientesCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(label2).addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label3).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label4).addComponent( scrollPane1, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label5).addComponent(notas, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(mensajeRespuesta, GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button1) .addContainerGap())); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }