List of usage examples for javax.swing JList JList
public JList()
JList
with an empty, read-only, model. From source file:au.org.ala.delta.intkey.ui.MultiStateInputDialog.java
/** * ctor/*from w w w. j a v a 2s .com*/ * * @param owner * Owner frame of dialog * @param ch * the character whose states are being set * @param initialSelectedStates * initial states that should be selected in the dialog. In * general this should be any states already set for the * character. In the case that this is a controlling character * being set before its dependent character, all states that make * the dependent character applicable should be selected. * @param dependentCharacter * the dependent character - if the dialog is being used to set a * controlling character before its dependent character, this * argument should be a reference to the dependent character. In * all other cases it should be null. * @param imageSettings * image settings * @param displayNumbering * true if numbering should be displayed * @param enableImagesButton * the if the images button should be enabled * @param imagesStartScaled * true if images should start scaled. */ public MultiStateInputDialog(Frame owner, MultiStateCharacter ch, Set<Integer> initialSelectedStates, au.org.ala.delta.model.Character dependentCharacter, ImageSettings imageSettings, boolean displayNumbering, boolean enableImagesButton, boolean imagesStartScaled, boolean advancedMode) { super(owner, ch, imageSettings, displayNumbering, enableImagesButton, imagesStartScaled, advancedMode); ResourceMap resourceMap = Application.getInstance().getContext() .getResourceMap(MultiStateInputDialog.class); resourceMap.injectFields(this); setTitle(title); setPreferredSize(new Dimension(600, 350)); if (dependentCharacter != null) { _pnlControllingCharacterMessage = new JPanel(); _pnlControllingCharacterMessage.setFocusable(false); _pnlControllingCharacterMessage.setBorder(new EmptyBorder(5, 0, 0, 0)); _pnlMain.add(_pnlControllingCharacterMessage, BorderLayout.SOUTH); _pnlControllingCharacterMessage.setLayout(new BorderLayout(0, 0)); _lblWarningIcon = new JLabel(""); _lblWarningIcon.setFocusable(false); _lblWarningIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon")); _pnlControllingCharacterMessage.add(_lblWarningIcon, BorderLayout.WEST); _txtControllingCharacterMessage = new JTextArea(); _txtControllingCharacterMessage.setText(MessageFormat.format(setControllingCharacterMessage, _formatter.formatCharacterDescription(dependentCharacter), _formatter.formatCharacterDescription(ch))); _txtControllingCharacterMessage.setFocusable(false); _txtControllingCharacterMessage.setBorder(new EmptyBorder(0, 5, 0, 0)); _txtControllingCharacterMessage.setEditable(false); _pnlControllingCharacterMessage.add(_txtControllingCharacterMessage); _txtControllingCharacterMessage.setWrapStyleWord(true); _txtControllingCharacterMessage.setFont(UIManager.getFont("Button.font")); _txtControllingCharacterMessage.setLineWrap(true); _txtControllingCharacterMessage.setBackground(SystemColor.control); } _scrollPane = new JScrollPane(); _pnlMain.add(_scrollPane, BorderLayout.CENTER); _list = new JList(); _scrollPane.setViewportView(_list); _listModel = new DefaultListModel(); for (int i = 0; i < ch.getNumberOfStates(); i++) { _listModel.addElement(_formatter.formatState(ch, i + 1)); } _list.setModel(_listModel); _list.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { // Treat double click on a list item as the ok button being // pressed. _okPressed = true; handleBtnOKClicked(); } } }); // Select the list items that correspond to the initial selected states. if (initialSelectedStates != null) { List<Integer> listIndiciesToSelect = new ArrayList<Integer>(); for (int stateNumber : new ArrayList<Integer>(initialSelectedStates)) { listIndiciesToSelect.add(stateNumber - 1); } Integer[] wrappedPrimitivesList = listIndiciesToSelect .toArray(new Integer[initialSelectedStates.size()]); _list.setSelectedIndices(ArrayUtils.toPrimitive(wrappedPrimitivesList)); } _inputData = new HashSet<Integer>(); }
From source file:hspc.submissionsprogram.AppDisplay.java
AppDisplay() { this.setTitle("Dominion High School Programming Contest"); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.setResizable(false); WindowListener exitListener = new WindowAdapter() { @Override/*w w w . j a v a 2s . co m*/ public void windowClosing(WindowEvent e) { System.exit(0); } }; this.addWindowListener(exitListener); JTabbedPane pane = new JTabbedPane(); this.add(pane); JPanel submitPanel = new JPanel(null); submitPanel.setPreferredSize(new Dimension(500, 500)); UIManager.put("FileChooser.readOnly", true); JFileChooser fileChooser = new JFileChooser(); fileChooser.setBounds(0, 0, 500, 350); fileChooser.setVisible(true); FileNameExtensionFilter javaFilter = new FileNameExtensionFilter("Java files (*.java)", "java"); fileChooser.setFileFilter(javaFilter); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setControlButtonsAreShown(false); submitPanel.add(fileChooser); JSeparator separator1 = new JSeparator(); separator1.setBounds(12, 350, 476, 2); separator1.setForeground(new Color(122, 138, 152)); submitPanel.add(separator1); JLabel problemChooserLabel = new JLabel("Problem:"); problemChooserLabel.setBounds(12, 360, 74, 25); submitPanel.add(problemChooserLabel); String[] listOfProblems = Main.Configuration.get("problem_names") .split(Main.Configuration.get("name_delimiter")); JComboBox problems = new JComboBox<>(listOfProblems); problems.setBounds(96, 360, 393, 25); submitPanel.add(problems); JButton submit = new JButton("Submit"); submit.setBounds(170, 458, 160, 30); submit.addActionListener(e -> { try { File file = fileChooser.getSelectedFile(); try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = new HttpPost(Main.Configuration.get("submit_url")); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addTextBody("accountID", Main.accountID, ContentType.TEXT_PLAIN); builder.addTextBody("problem", String.valueOf(problems.getSelectedItem()), ContentType.TEXT_PLAIN); builder.addBinaryBody("submission", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); CloseableHttpResponse response = httpClient.execute(uploadFile); HttpEntity responseEntity = response.getEntity(); String inputLine; BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent())); try { if ((inputLine = br.readLine()) != null) { int rowIndex = Integer.parseInt(inputLine); new ResultWatcher(rowIndex); } br.close(); } catch (IOException ex) { ex.printStackTrace(); } } catch (Exception ex) { ex.printStackTrace(); } } catch (NullPointerException ex) { JOptionPane.showMessageDialog(this, "No file selected.\nPlease select a java file.", "Error", JOptionPane.WARNING_MESSAGE); } }); submitPanel.add(submit); JPanel clarificationsPanel = new JPanel(null); clarificationsPanel.setPreferredSize(new Dimension(500, 500)); cList = new JList<>(); cList.setBounds(12, 12, 476, 200); cList.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); cList.setBackground(new Color(254, 254, 255)); clarificationsPanel.add(cList); JButton viewC = new JButton("View"); viewC.setBounds(12, 224, 232, 25); viewC.addActionListener(e -> { if (cList.getSelectedIndex() != -1) { int id = Integer.parseInt(cList.getSelectedValue().split("\\.")[0]); clarificationDatas.stream().filter(data -> data.getId() == id).forEach( data -> new ClarificationDisplay(data.getProblem(), data.getText(), data.getResponse())); } }); clarificationsPanel.add(viewC); JButton refreshC = new JButton("Refresh"); refreshC.setBounds(256, 224, 232, 25); refreshC.addActionListener(e -> updateCList(true)); clarificationsPanel.add(refreshC); JSeparator separator2 = new JSeparator(); separator2.setBounds(12, 261, 476, 2); separator2.setForeground(new Color(122, 138, 152)); clarificationsPanel.add(separator2); JLabel problemChooserLabelC = new JLabel("Problem:"); problemChooserLabelC.setBounds(12, 273, 74, 25); clarificationsPanel.add(problemChooserLabelC); JComboBox problemsC = new JComboBox<>(listOfProblems); problemsC.setBounds(96, 273, 393, 25); clarificationsPanel.add(problemsC); JTextArea textAreaC = new JTextArea(); textAreaC.setLineWrap(true); textAreaC.setWrapStyleWord(true); textAreaC.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); textAreaC.setBackground(new Color(254, 254, 255)); JScrollPane areaScrollPane = new JScrollPane(textAreaC); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setBounds(12, 312, 477, 134); clarificationsPanel.add(areaScrollPane); JButton submitC = new JButton("Submit Clarification"); submitC.setBounds(170, 458, 160, 30); submitC.addActionListener(e -> { if (textAreaC.getText().length() > 2048) { JOptionPane.showMessageDialog(this, "Clarification body is too long.\nMaximum of 2048 characters allowed.", "Error", JOptionPane.WARNING_MESSAGE); } else if (textAreaC.getText().length() < 20) { JOptionPane.showMessageDialog(this, "Clarification body is too short.\nClarifications must be at least 20 characters, but no more than 2048.", "Error", JOptionPane.WARNING_MESSAGE); } else { Connection conn = null; PreparedStatement stmt = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(Main.Configuration.get("jdbc_mysql_address"), Main.Configuration.get("mysql_user"), Main.Configuration.get("mysql_pass")); String sql = "INSERT INTO clarifications (team, problem, text) VALUES (?, ?, ?)"; stmt = conn.prepareStatement(sql); stmt.setInt(1, Integer.parseInt(String.valueOf(Main.accountID))); stmt.setString(2, String.valueOf(problemsC.getSelectedItem())); stmt.setString(3, String.valueOf(textAreaC.getText())); textAreaC.setText(""); stmt.executeUpdate(); stmt.close(); conn.close(); updateCList(false); } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (stmt != null) { stmt.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } try { if (conn != null) { conn.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } } } }); clarificationsPanel.add(submitC); pane.addTab("Submit", submitPanel); pane.addTab("Clarifications", clarificationsPanel); Timer timer = new Timer(); TimerTask updateTask = new TimerTask() { @Override public void run() { updateCList(false); } }; timer.schedule(updateTask, 10000, 10000); updateCList(false); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:fungus.MycoNodeFrame.java
public MycoNodeFrame(MycoNode node) { this.node = node; this.setTitle("Node " + node.getID()); graph = JungGraphObserver.getGraph(); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); JPanel labelPane = new JPanel(); labelPane.setLayout(new GridLayout(7, 2)); JPanel neighborPane = new JPanel(); neighborPane.setLayout(new BoxLayout(neighborPane, BoxLayout.PAGE_AXIS)); JPanel logPane = new JPanel(); logPane.setLayout(new BoxLayout(logPane, BoxLayout.PAGE_AXIS)); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); loggingTextArea = new JTextArea("", 25, 100); loggingTextArea.setLineWrap(true);// www . ja v a2s. c om loggingTextArea.setEditable(false); handler = new MycoNodeLogHandler(node, loggingTextArea); handler.addChangeListener(this); JScrollPane logScrollPane = new JScrollPane(loggingTextArea); logScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); logPane.add(logScrollPane); contentPane.add(labelPane); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); contentPane.add(neighborPane); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); contentPane.add(logPane); contentPane.add(buttonPane); data = node.getHyphaData(); link = node.getHyphaLink(); mycocast = node.getMycoCast(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); stateLabel = new JLabel(); typeLabel = new JLabel(); queueLengthLabel = new JLabel(); sameLabel = new JLabel(); differentLabel = new JLabel(); maxCapacityLabel = new JLabel(); idealImmobileLabel = new JLabel(); idealHyphaeLabel = new JLabel(); idealBiomassLabel = new JLabel(); degreeLabel = new JLabel(); hyphaDegreeLabel = new JLabel(); biomassDegreeLabel = new JLabel(); hyphaUtilizationLabel = new JLabel(); biomassUtilizationLabel = new JLabel(); capacityUtilizationLabel = new JLabel(); labelPane.add(new JLabel("state")); labelPane.add(stateLabel); labelPane.add(new JLabel("type")); labelPane.add(typeLabel); labelPane.add(new JLabel("queue")); labelPane.add(queueLengthLabel); labelPane.add(new JLabel("")); labelPane.add(new JLabel("")); labelPane.add(new JLabel("same")); labelPane.add(sameLabel); labelPane.add(new JLabel("different")); labelPane.add(differentLabel); //labelPane.add(new JLabel("immobile")); //labelPane.add(idealImmobileLabel); labelPane.add(new JLabel("")); labelPane.add(new JLabel("actual")); labelPane.add(new JLabel("ideal")); labelPane.add(new JLabel("utilization")); labelPane.add(new JLabel("hyphae")); labelPane.add(hyphaDegreeLabel); labelPane.add(idealHyphaeLabel); labelPane.add(hyphaUtilizationLabel); labelPane.add(new JLabel("biomass")); labelPane.add(biomassDegreeLabel); labelPane.add(idealBiomassLabel); labelPane.add(biomassUtilizationLabel); labelPane.add(new JLabel("capacity")); labelPane.add(degreeLabel); labelPane.add(maxCapacityLabel); labelPane.add(capacityUtilizationLabel); neighborListControl = new JList(); neighborListControl.setLayoutOrientation(JList.VERTICAL_WRAP); neighborListControl.setVisibleRowCount(-1); neighborListScroller = new JScrollPane(neighborListControl); neighborListScroller.setPreferredSize(new Dimension(250, 150)); neighborListScroller.setMinimumSize(new Dimension(250, 150)); neighborPane.add(neighborListScroller); JButton updateButton = new JButton("Refresh"); ActionListener updater = new ActionListener() { public void actionPerformed(ActionEvent e) { refreshData(); } }; updateButton.addActionListener(updater); JButton closeButton = new JButton("Close"); ActionListener closer = new ActionListener() { public void actionPerformed(ActionEvent e) { closeFrame(); } }; closeButton.addActionListener(closer); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(updateButton); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(closeButton); refreshData(); JungGraphObserver.addChangeListener(this); this.pack(); this.setVisible(true); }
From source file:gtu.zcognos.DimensionUI.java
private void initGUI() { try {//from www . j av a2 s.co 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:SuitaDetails.java
private void initGlobal() { suiteoptions = new JPanel(); suiteoptions.setBackground(Color.WHITE); JLabel suite = new JLabel("Suite name: "); tsuite = new JTextField(); ep = new JLabel("Run on SUT:"); combo = new JList(); suitelib = new JButton("Libraries"); panicdetect = new JCheckBox("Panic Detect"); panicdetect.setBackground(Color.WHITE); JScrollPane scroll = new JScrollPane(); scroll.setViewportView(combo);//from w w w.j a v a 2 s . c o m GroupLayout layout = new GroupLayout(suiteoptions); suiteoptions.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(panicdetect) .addComponent(suitelib, GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ep).addComponent(suite)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(tsuite) .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout .createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(suite) .addComponent(tsuite, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(panicdetect) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(suitelib)) .addComponent(ep)) .addContainerGap())); tcdelay = new JLabel("TC delay"); savedb = new JCheckBox("DB autosave"); ttcdelay = new JTextField(); JButton globallib = new JButton("Libraries"); savedb.setBackground(Color.WHITE); stoponfail = new JCheckBox("Stop on fail"); stoponfail.setBackground(Color.WHITE); JLabel prescript = new JLabel(); JLabel postscript = new JLabel(); prestoponfail = new JCheckBox("Stop on fail"); prestoponfail.setBackground(Color.WHITE); tprescript = new JTextField(); tpostscript = new JTextField(); browse1 = new JButton("..."); browse2 = new JButton("..."); prescript.setText("Pre execution script:"); postscript.setText("Post execution script:"); globallib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showLib(); } }); suitelib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showSuiteLib(); } }); browse1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tprescript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); browse2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tpostscript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); panicdetect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { parent.setPanicdetect(panicdetect.isSelected()); } }); layout = new GroupLayout(global); global.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(tcdelay) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(ttcdelay, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE).addGap(12, 12, 12) .addComponent(globallib)) .addGroup(layout.createSequentialGroup().addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(prescript).addGap(20, 20, 20)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(postscript).addGap(18, 18, 18))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tpostscript).addComponent(tprescript)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(browse1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(prestoponfail)) .addComponent(browse2)))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(12, 12, 12) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(tcdelay) .addComponent(ttcdelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(globallib)) .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(prescript) .addComponent(tprescript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse1).addComponent(prestoponfail)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tpostscript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse2).addComponent(postscript)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse1, tprescript }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse2, tpostscript }); }
From source file:gtu._work.mvn.MavenRepositoryUI.java
private void initGUI() { try {//from ww w .j ava2 s .co m { } BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); scanList = new JList(); jTabbedPane1.addTab("repository", null, jPanel1, null); { scanText = new JTextField(); jPanel1.add(scanText, BorderLayout.NORTH); } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { ListModel scanListModel = new DefaultListModel(); jScrollPane1.setViewportView(scanList); scanList.setModel(scanListModel); scanList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(scanList, evt); } }); } } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("repository only jar", null, jPanel4, null); jPanel4.setPreferredSize(new java.awt.Dimension(520, 298)); { scanText2 = new JTextField(); jPanel4.add(scanText2, BorderLayout.NORTH); } { jScrollPane3 = new JScrollPane(); jPanel4.add(jScrollPane3, BorderLayout.CENTER); { scanList2 = new JList(); jScrollPane3.setViewportView(scanList2); ListModel scanList2Model = new DefaultListModel(); scanList2.setModel(scanList2Model); scanList2.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(scanList2, evt); } }); } } { } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("jar find", null, jPanel2, null); { jarFindText = new JTextField(); jPanel2.add(jarFindText, BorderLayout.NORTH); } { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); { ListModel jarFindListModel = new DefaultListModel(); jarFindList = new JList(); jScrollPane2.setViewportView(jarFindList); jarFindList.setModel(jarFindListModel); jarFindList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(jarFindList, evt); } }); } } { jarFindExecute = new JButton(); jPanel2.add(jarFindExecute, BorderLayout.SOUTH); jarFindExecute.setText("find"); jarFindExecute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String searchtext = jarFindText.getText(); if (StringUtils.isEmpty(searchtext) || searchtext.length() < 2) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("", "error"); return; } try { DefaultListModel model = new DefaultListModel(); jarFindList.setModel(model); searchtext = searchtext.trim(); searchtext = searchtext.replace('/', '.'); searchtext = searchtext.replace('\\', '.'); if (jarfinder == null) { jarfinder = JarFinder.newInstance(); } else { jarfinder.clear(); } jarfinder.pattern(searchtext); DefaultListModel scanModel = (DefaultListModel) scanList.getModel(); PomFile pomFile = null; for (int ii = 0; ii < scanModel.getSize(); ii++) { pomFile = (PomFile) scanModel.getElementAt(ii); if (pomFile.jarFile == null) { continue; } jarfinder.setDir(pomFile.jarFile); if (!jarfinder.execute().isEmpty()) { model.addElement(pomFile); } jarfinder.getMap().clear(); } } catch (Exception ex) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog(ex.getMessage(), "error"); ex.printStackTrace(); } } }); } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jTabbedPane1.addTab("detail", null, jPanel5, null); jPanel5.setLayout(jPanel5Layout); { jScrollPane4 = new JScrollPane(); jPanel5.add(jScrollPane4, BorderLayout.CENTER); { TableModel scanTableModel = new DefaultTableModel(); scanTable = new JTable(); BorderLayout scanTableLayout = new BorderLayout(); scanTable.setLayout(scanTableLayout); jScrollPane4.setViewportView(scanTable); scanTable.setModel(scanTableModel); JTableUtil.defaultSetting(scanTable); scanTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { tableMouseClicked(scanTable, 0, evt); } }); } } } { jPanel3 = new JPanel(); jTabbedPane1.addTab("config", null, jPanel3, null); GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3); jPanel3.setLayout(jPanel3Layout); { copyToDir = new JButton(); copyToDir.setText("set copy to dir"); copyToDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null || !file.exists() || !file.isDirectory()) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!, set default desktop", "error"); file = FileUtil.DESKTOP_DIR; } copyTo = file; System.out.println("copyTo: " + copyTo); } }); } { resetM2Dir = new JButton(); resetM2Dir.setText("set .m2 dir"); resetM2Dir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null || !file.exists() || !file.isDirectory()) { showErrorMsg(); repositoryDir = DEFAULT_REPOSITORY_DIR; reloadRepositoryDir(); return; } File newRepository = new File(file, "repository"); File settings = new File(file, "settings.xml"); if (settings.exists() && settings.isFile() && newRepository.exists() && newRepository.isDirectory()) { repositoryDir = newRepository; reloadRepositoryDir(); } else { showErrorMsg(); } } void showErrorMsg() { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!, set default .m2 dir", "error"); } }); } { saveCurrentDataBtn = new JButton(); saveCurrentDataBtn.setText("save current data"); saveCurrentDataBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File cfgFile = new File(PropertiesUtil.getJarCurrentPath(MavenRepositoryUI.class), MavenRepositoryUI.class.getSimpleName() + "_" + DateFormatUtil .format(System.currentTimeMillis(), "yyyyMMdd_HHmmss") + ".cfg"); try { ObjectOutputStream writer = new ObjectOutputStream( new FileOutputStream(cfgFile)); writer.writeObject(pomFileList); writer.writeObject(pomFileJarList); writer.writeObject(pomFileMap); writer.flush(); writer.close(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("save completed!\n" + cfgFile, "SUCCESS"); } catch (Exception ex) { JCommonUtil.handleException(ex); ex.printStackTrace(); } } }); } { loadConfigDataBtn = new JButton(); loadConfigDataBtn.setText("load config data"); loadConfigDataBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File cfgFile = JFileChooserUtil.newInstance().selectFileOnly() .addAcceptFile("cfg", ".cfg").showOpenDialog().getApproveSelectedFile(); if (cfgFile == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!", "ERROR"); return; } try { ObjectInputStream reader = new ObjectInputStream(new FileInputStream(cfgFile)); pomFileList = (Set<PomFile>) reader.readObject(); pomFileJarList = (Set<PomFile>) reader.readObject(); pomFileMap = (Map<DependencyKey, PomFile>) reader.readObject(); reader.close(); resetUIStatus(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("load completed!\n" + cfgFile, "SUCCESS"); } catch (Exception ex) { JCommonUtil.handleException(ex); ex.printStackTrace(); } } }); } jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(24, 24) .addGroup(jPanel3Layout.createParallelGroup() .addGroup(jPanel3Layout.createSequentialGroup().addComponent(loadConfigDataBtn, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(saveCurrentDataBtn, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(copyToDir, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(resetM2Dir, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(getJButton1(), GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))) .addContainerGap(281, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(25, 25) .addComponent(copyToDir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addGap(22) .addComponent(resetM2Dir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addGap(24) .addComponent(saveCurrentDataBtn, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addGap(25) .addComponent(loadConfigDataBtn, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addGap(28) .addComponent(getJButton1(), GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addContainerGap(34, Short.MAX_VALUE)); } { jPanel6 = new JPanel(); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("pom dency", null, jPanel6, null); { openPom = new JButton(); jPanel6.add(openPom, BorderLayout.NORTH); openPom.setText("open"); openPom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectFileAndDirectory() .showDialog("?pom,pom").getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!!", "ERROR"); return; } List<File> pomList = new ArrayList<File>(); if (file.isFile() && (file.getName().endsWith(".xml") || file.getName().endsWith(".pom"))) { pomList.add(file); } else { FileUtil.searchFileMatchs(file, "pom.xml", pomList); } Set<PomFile> poms = loadPomList(pomList); resetUIStatus(); Map<DependencyKey, PomFile> map = new HashMap<DependencyKey, PomFile>(); Set<LoadPomListDependency.DependencyKey> errorSet = new HashSet<LoadPomListDependency.DependencyKey>(); for (PomFile p : poms) { openPomFetchDependency(p.pom, map, errorSet); } PomFile pfile = null; DefaultTableModel model = JTableUtil.createModel(true, "groupId", "artifactId", "jar", "pomFile"); for (DependencyKey key : map.keySet()) { pfile = map.get(key); model.addRow(new Object[] { pfile.pom.groupId, pfile.pom.artifactId, (pfile.jarFile == null ? "" : pfile.jarFile.getName()), pfile }); } for (LoadPomListDependency.DependencyKey key : errorSet) { model.addRow(new Object[] { key.groupId, key.artifactId, "ERROR" }); } pomDenpendencyTable.setModel(model); } }); } { jScrollPane5 = new JScrollPane(); jPanel6.add(jScrollPane5, BorderLayout.CENTER); { TableModel pomDenpendencyTableModel = new DefaultTableModel(); pomDenpendencyTable = new JTable(); jScrollPane5.setViewportView(pomDenpendencyTable); pomDenpendencyTable.setModel(pomDenpendencyTableModel); pomDenpendencyTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { tableMouseClicked(pomDenpendencyTable, 3, evt); } }); JTableUtil.defaultSetting(pomDenpendencyTable); } } { jPanel7 = new JPanel(); FlowLayout jPanel7Layout = new FlowLayout(); jPanel7Layout.setAlignOnBaseline(true); jPanel6.add(jPanel7, BorderLayout.SOUTH); jPanel7.setLayout(jPanel7Layout); jPanel7.setPreferredSize(new java.awt.Dimension(520, 36)); { clipboardListJar = new JButton(); jPanel7.add(clipboardListJar); clipboardListJar.setText("jar list to clipboard"); clipboardListJar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { List<File> list = fetchPomDependencyTableJarList(); StringBuilder sb = new StringBuilder(); for (File f : list) { sb.append(f + "\n"); } ClipboardUtil.getInstance().setContents(sb); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("clipboard set ok!", "SUCCESS"); } }); } { pomOutputJarDir = new JButton(); jPanel7.add(pomOutputJarDir); pomOutputJarDir.setText("set output jar dir"); pomOutputJarDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly() .showDialog("?Jar").getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!!", "ERROR"); return; } pomOutputJarDir_ = file; } }); } { exportListJar = new JButton(); jPanel7.add(exportListJar); exportListJar.setText("export list jar"); exportListJar.setPreferredSize(new java.awt.Dimension(113, 24)); exportListJar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { List<File> list = fetchPomDependencyTableJarList(); if (pomOutputJarDir_ == null || !pomOutputJarDir_.exists() || !pomOutputJarDir_.isDirectory()) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("output dir is not correct!!", "ERROR"); return; } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION == JOptionPaneUtil .newInstance().confirmButtonYesNo().iconWaringMessage() .showConfirmDialog("are you sure copy list jar count:(" + list.size() + ") to\n" + pomOutputJarDir_, "WARN")) { StringBuilder sb = new StringBuilder(); StringBuilder fsb = new StringBuilder(); sb.append("total : " + list.size() + "\n"); int ok = 0; int noOk = 0; for (File f : list) { try { FileUtil.copyFile(f, new File(pomOutputJarDir_, f.getName())); ok++; } catch (IOException e) { e.printStackTrace(); noOk++; fsb.append(f + "\n"); } } sb.append("success : " + ok + "\n"); sb.append("failed : " + noOk + "\n"); sb.append("Failed jar :\n"); sb.append(fsb); JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(sb, "COPY RESULT"); } } }); } } } } this.setSize(541, 365); reloadRepositoryDir(); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.openbyte.gui.WelcomeFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee scrollPane1 = new JScrollPane(); list1 = new JList(); button1 = new JButton(); label2 = new JLabel(); button2 = new JButton(); button3 = new JButton(); button4 = new JButton(); button5 = new JButton(); scrollPane2 = new JScrollPane(); xImagePanel1 = new JXImagePanel(); button6 = new JButton(); button7 = new JButton(); button8 = new JButton(); //======== this ======== setTitle("Welcome to OpenByte"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setResizable(false);/* w w w .j a va 2 s.com*/ Container contentPane = getContentPane(); contentPane.setLayout(null); //======== scrollPane1 ======== { scrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Recent Projects")); //---- list1 ---- list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list1.setBackground(new Color(240, 240, 240)); list1.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { list1ValueChanged(e); } }); scrollPane1.setViewportView(list1); } contentPane.add(scrollPane1); scrollPane1.setBounds(15, 10, 165, 340); //---- button1 ---- button1.setText("Open Project"); button1.setEnabled(false); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); contentPane.add(button1); button1.setBounds(105, 355, 110, button1.getPreferredSize().height); //---- label2 ---- label2.setText("Media"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(605, 210), label2.getPreferredSize())); //---- button2 ---- button2.setText("Minecraft Forums"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); contentPane.add(button2); button2.setBounds(500, 230, 151, button2.getPreferredSize().height); //---- button3 ---- button3.setText("GitHub"); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button3ActionPerformed(e); } }); contentPane.add(button3); button3.setBounds(500, 260, 150, button3.getPreferredSize().height); //---- button4 ---- button4.setText("+"); button4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button4ActionPerformed(e); } }); contentPane.add(button4); button4.setBounds(15, 355, 45, button4.getPreferredSize().height); //---- button5 ---- button5.setText("-"); button5.setEnabled(false); button5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button5ActionPerformed(e); } }); contentPane.add(button5); button5.setBounds(60, 355, 40, button5.getPreferredSize().height); //======== scrollPane2 ======== { scrollPane2.setBorder(null); scrollPane2.setViewportView(xImagePanel1); } contentPane.add(scrollPane2); scrollPane2.setBounds(210, 25, 445, 160); //---- button6 ---- button6.setText("Preferences"); button6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button6ActionPerformed(e); } }); contentPane.add(button6); button6.setBounds(500, 290, 150, 30); //---- button7 ---- button7.setText("About"); button7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button7ActionPerformed(e); } }); contentPane.add(button7); button7.setBounds(500, 320, 150, 30); //---- button8 ---- button8.setText("Plugins"); button8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button8ActionPerformed(e); } }); contentPane.add(button8); button8.setBounds(500, 350, 150, 30); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } setSize(675, 425); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:ca.uhn.hl7v2.testpanel.ui.AddMessageDialog.java
/** * Create the dialog./*from w w w. jav a 2 s. com*/ */ public AddMessageDialog(Controller theController) { myController = theController; setMinimumSize(new Dimension(450, 400)); setPreferredSize(new Dimension(450, 400)); setSize(new Dimension(450, 400)); setResizable(false); setMaximumSize(new Dimension(450, 400)); setTitle("Add Message"); setBounds(100, 100, 450, 401); getContentPane().setLayout(new BorderLayout()); mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(mycontentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 0, 0 }; gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE }; mycontentPanel.setLayout(gbl_contentPanel); { JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Message Type", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.weighty = 1.0; gbc_panel.insets = new Insets(0, 0, 5, 0); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 0; gbc_panel.gridy = 0; mycontentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 0, 0, 0 }; gbl_panel.rowHeights = new int[] { 0, 0, 0 }; gbl_panel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { JLabel lblVersion = new JLabel("Version"); GridBagConstraints gbc_lblVersion = new GridBagConstraints(); gbc_lblVersion.insets = new Insets(0, 0, 5, 5); gbc_lblVersion.gridx = 0; gbc_lblVersion.gridy = 0; panel.add(lblVersion, gbc_lblVersion); } { JLabel lblType = new JLabel("Type"); GridBagConstraints gbc_lblType = new GridBagConstraints(); gbc_lblType.insets = new Insets(0, 0, 5, 0); gbc_lblType.gridx = 1; gbc_lblType.gridy = 0; panel.add(lblType, gbc_lblType); } { JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportBorder(null); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.weighty = 1.0; gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 1; panel.add(scrollPane, gbc_scrollPane); { myVersionList = new JList(); myVersionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(myVersionList); } } { JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportBorder(null); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.weighty = 1.0; gbc_scrollPane.weightx = 1.0; gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 1; panel.add(scrollPane, gbc_scrollPane); { myMessageTypeList = new JList(); myMessageTypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(myMessageTypeList); } } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 0; gbc_panel.gridy = 1; mycontentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 0, 0, 0 }; gbl_panel.rowHeights = new int[] { 0, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { JLabel lblEncoding = new JLabel("Encoding"); GridBagConstraints gbc_lblEncoding = new GridBagConstraints(); gbc_lblEncoding.insets = new Insets(0, 0, 0, 5); gbc_lblEncoding.gridx = 0; gbc_lblEncoding.gridy = 0; panel.add(lblEncoding, gbc_lblEncoding); } { JPanel panel_1 = new JPanel(); panel_1.setBorder(null); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.anchor = GridBagConstraints.WEST; gbc_panel_1.fill = GridBagConstraints.VERTICAL; gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 0; panel.add(panel_1, gbc_panel_1); { myEr7Radio = new JRadioButton("ER7"); myEr7Radio.setSelected(true); encodingButtonGroup.add(myEr7Radio); panel_1.add(myEr7Radio); } { JRadioButton myXmlRadio = new JRadioButton("XML"); encodingButtonGroup.add(myXmlRadio); panel_1.add(myXmlRadio); } } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { String version = (String) myVersionList.getSelectedValue(); String fullType = (String) myMessageTypeList.getSelectedValue(); String structure = myTypesToStructures.get(fullType); String[] fullTypeBits = fullType.split("\\^"); String type = fullTypeBits[0]; String trigger = fullTypeBits[1]; Hl7V2EncodingTypeEnum encoding = myEr7Radio.isSelected() ? Hl7V2EncodingTypeEnum.ER_7 : Hl7V2EncodingTypeEnum.XML; myController.addMessage(version, type, trigger, structure, encoding); } finally { setVisible(false); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AddMessageDialog.this.setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } initLocal(); }
From source file:com.mirth.connect.client.ui.NotificationDialog.java
private void initComponents() { setLayout(new MigLayout("insets 12", "[]", "[fill][]")); notificationPanel = new JPanel(); notificationPanel.setLayout(new MigLayout("insets 0 0 0 0, fill", "[200!][]", "[25!]0[]")); notificationPanel.setBackground(UIConstants.BACKGROUND_COLOR); archiveAll = new JLabel("Archive All"); archiveAll.setForeground(java.awt.Color.blue); archiveAll.setText("<html><u>Archive All</u></html>"); archiveAll.setToolTipText("Archive all notifications below."); archiveAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); newNotificationsLabel = new JLabel(); newNotificationsLabel.setFont(newNotificationsLabel.getFont().deriveFont(Font.BOLD)); headerListPanel = new JPanel(); headerListPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); headerListPanel.setLayout(new MigLayout("insets 2, fill")); headerListPanel.setBorder(BorderFactory.createLineBorder(borderColor)); list = new JList(); list.setCellRenderer(new NotificationListCellRenderer()); list.addListSelectionListener(new ListSelectionListener() { @Override/* w w w . j a va 2s . c o m*/ public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { currentNotification = (Notification) list.getSelectedValue(); if (currentNotification != null) { notificationNameTextField.setText(currentNotification.getName()); contentTextPane.setText(currentNotification.getContent()); archiveSelected(); } } } }); listScrollPane = new JScrollPane(); listScrollPane.setBackground(UIConstants.BACKGROUND_COLOR); listScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); listScrollPane.setViewportView(list); listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); archiveLabel = new JLabel(); archiveLabel.setForeground(java.awt.Color.blue); archiveLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); notificationNameTextField = new JTextField(); notificationNameTextField.setFont(notificationNameTextField.getFont().deriveFont(Font.BOLD)); notificationNameTextField.setEditable(false); notificationNameTextField.setFocusable(false); notificationNameTextField.setBorder(BorderFactory.createEmptyBorder()); notificationNameTextField.setBackground(UIConstants.HIGHLIGHTER_COLOR); DefaultCaret nameCaret = (DefaultCaret) notificationNameTextField.getCaret(); nameCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); headerContentPanel = new JPanel(); headerContentPanel.setLayout(new MigLayout("insets 2, fill")); headerContentPanel.setBorder(BorderFactory.createLineBorder(borderColor)); headerContentPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); contentTextPane = new JTextPane(); contentTextPane.setContentType("text/html"); contentTextPane.setEditable(false); contentTextPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == EventType.ACTIVATED && Desktop.isDesktopSupported()) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(evt.getURL().toURI()); } else { BareBonesBrowserLaunch.openURL(evt.getURL().toString()); } } catch (Exception e) { e.printStackTrace(); } } } }); DefaultCaret contentCaret = (DefaultCaret) contentTextPane.getCaret(); contentCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); contentScrollPane = new JScrollPane(); contentScrollPane.setViewportView(contentTextPane); contentScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); archiveLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int index = list.getSelectedIndex(); if (currentNotification.isArchived()) { notificationModel.setArchived(false, index); unarchivedCount++; } else { notificationModel.setArchived(true, index); unarchivedCount--; } archiveSelected(); updateUnarchivedCountLabel(); } }); archiveAll.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { for (int i = 0; i < notificationModel.getSize(); i++) { notificationModel.setArchived(true, i); } unarchivedCount = 0; archiveSelected(); updateUnarchivedCountLabel(); } }); notificationCheckBox = new JCheckBox("Show new notifications on login"); notificationCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) { checkForNotificationsSetting = true; if (showNotificationPopup == null || BooleanUtils.toBoolean(showNotificationPopup)) { notificationCheckBox.setSelected(true); } else { notificationCheckBox.setSelected(false); } } else { notificationCheckBox.setSelected(false); } notificationCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (notificationCheckBox.isSelected() && !checkForNotificationsSetting) { alertSettingsChange(); } } }); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doSave(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doSave(); } }); }
From source file:net.sf.jabref.wizard.auximport.gui.FromAuxDialog.java
private void initPanels() { // collect the names of all open databases int len = parentTabbedPane.getTabCount(); int toSelect = -1; for (int i = 0; i < len; i++) { dbChooser.addItem(parentTabbedPane.getTitleAt(i)); if (parent.getBasePanelAt(i) == parent.getCurrentBasePanel()) { toSelect = i;/*from w w w .jav a 2s . c o m*/ } } if (toSelect >= 0) { dbChooser.setSelectedIndex(toSelect); } auxFileField = new JTextField("", 25); JButton browseAuxFileButton = new JButton(Localization.lang("Browse")); browseAuxFileButton.addActionListener(new BrowseAction(auxFileField, parent)); notFoundList = new JList<>(); JScrollPane listScrollPane = new JScrollPane(notFoundList); //listScrollPane.setPreferredSize(new Dimension(250, 120)); statusInfos = new JTextArea("", 5, 20); JScrollPane statusScrollPane = new JScrollPane(statusInfos); //statusScrollPane.setPreferredSize(new Dimension(250, 120)); //statusInfos.setBorder(BorderFactory.createEtchedBorder()); statusInfos.setEditable(false); DefaultFormBuilder b = new DefaultFormBuilder( new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, left:pref", ""), buttons); b.appendSeparator(Localization.lang("Options")); b.append(Localization.lang("Reference database") + ":"); b.append(dbChooser, 3); b.nextLine(); b.append(Localization.lang("LaTeX AUX file") + ":"); b.append(auxFileField); b.append(browseAuxFileButton); b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); b = new DefaultFormBuilder( new FormLayout("fill:pref:grow, 4dlu, fill:pref:grow", "pref, pref, fill:pref:grow"), statusPanel); b.appendSeparator(Localization.lang("Result")); b.append(Localization.lang("Unknown bibtex entries") + ":"); b.append(Localization.lang("Messages") + ":"); b.nextLine(); b.append(listScrollPane); b.append(statusScrollPane); b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }