List of usage examples for java.awt FlowLayout setAlignOnBaseline
public void setAlignOnBaseline(boolean alignOnBaseline)
From source file:com.qawaa.gui.PointAnalysisGUI.java
/** * Auto-generated main method to display this JFrame *///from w w w . ja v a2s.c o m public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { PointAnalysisGUI inst = new PointAnalysisGUI(); inst.setLocationRelativeTo(null); inst.setVisible(true); inst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setAlignOnBaseline(true); inst.setTitle(PROGRAM_NAME + " [" + PROGRAM_VERSION + "] " + " - " + DefaultMessage.SOFT_NAME + " - " + DefaultMessage.COMPANY_NAME); { consoleScrollPane = new JScrollPane(); inst.getContentPane().add(consoleScrollPane, BorderLayout.CENTER); { consolePane = new JEditorPane(); consoleScrollPane.setViewportView(consolePane); consolePane.setText(""); setConsoleRight(); jConsole = new JConsole(System.out, consolePane); System.setOut(jConsole); System.setErr(jConsole); consolePane.setEditable(false); consolePane.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseReleased(java.awt.event.MouseEvent) */ public void mouseReleased(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { consolePane.add(consoleRight); consoleRight.show(e.getComponent(), e.getX(), e.getY()); } } }); } } { infoPanel = new JPanel(); inst.getContentPane().add(infoPanel, BorderLayout.SOUTH); infoPanel.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); infoPanel.setPreferredSize(new Dimension(784, 30)); infoPanel.setLayout(flowLayout); { { statusbar_count = new JTextPane(); infoPanel.add(statusbar_count); statusbar_count .setText(CONTEXT.getMessage("point.statusbar.count", null, Locale.CHINA)); statusbar_count.setBackground(null); statusbar_count.setEditable(false); } { statusbar_count_value = new JTextPane(); infoPanel.add(statusbar_count_value); statusbar_count_value.setText(String.valueOf(SCAN_COUNT)); statusbar_count_value.setBackground(null); statusbar_count_value.setEditable(false); statusbar_count_value.setEnabled(false); } { programPID = new JTextPane(); infoPanel.add(programPID); programPID.setText("PID:"); programPID.setBackground(null); programPID.setEditable(false); } { programPID_value = new JTextPane(); infoPanel.add(programPID_value); programPID_value.setText(JvmPid.getPID()); programPID_value.setBackground(null); programPID_value.setEditable(false); programPID_value.setEnabled(false); } { memory = new JTextPane(); infoPanel.add(memory); memory.setText(CONTEXT.getMessage("gobal.gui.memory", null, Locale.CHINA)); memory.setBackground(null); memory.setEditable(false); } { memory_value = new JTextPane(); infoPanel.add(memory_value); memory_value.setText("0KB"); memory_value.setBackground(null); memory_value.setEditable(false); memory_value.setEnabled(false); MemoryListener memory = new MemoryListener(memory_value); memory.start(); } { runtime = new JTextPane(); infoPanel.add(runtime); runtime.setText(CONTEXT.getMessage("gobal.gui.runtime", null, Locale.CHINA)); runtime.setBackground(null); runtime.setEditable(false); } { runtime_value = new JTextPane(); infoPanel.add(runtime_value); runtime_value.setText("NULL"); runtime_value.setBackground(null); runtime_value.setEditable(false); runtime_value.setEnabled(false); } } } { shortcut = new JPanel(); inst.getContentPane().add(shortcut, BorderLayout.NORTH); shortcut.setSize(784, 35); shortcut.setPreferredSize(new Dimension(784, 35)); shortcut.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); shortcut.setLayout(new BorderLayout()); { eventText = new JTextPane(); shortcut.add(eventText, BorderLayout.WEST); eventText.setText(CONTEXT.getMessage("point.event.name", null, Locale.CHINA) + ": "); eventText.setEditable(false); eventText.setEnabled(true); eventText.setBackground(null); eventText.setCaretColor(new Color(0, 0, 0)); } { eventTextField = new JTextField(); shortcut.add(eventTextField, BorderLayout.CENTER); eventTextField.setSize(500, 25); eventTextField.setText(""); eventTextField.setPreferredSize(new Dimension(500, 25)); eventTextField.setEditable(false); } { submit = new JButton(); shortcut.add(submit, BorderLayout.EAST); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setSize(new Dimension(75, 25)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { submitActionPerformed(evt); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } } }); }
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * Auto-generated main method to display this JFrame *///from w w w .j ava 2 s. c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { EventWebScanGUI inst = new EventWebScanGUI(); inst.setLocationRelativeTo(null); inst.setVisible(true); inst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setAlignOnBaseline(true); inst.setTitle(PROGRAM_NAME + " [" + PROGRAM_VERSION + "] " + " - " + DefaultMessage.SOFT_NAME + " - " + DefaultMessage.COMPANY_NAME); { consoleScrollPane = new JScrollPane(); inst.getContentPane().add(consoleScrollPane, BorderLayout.CENTER); { consolePane = new JEditorPane(); consoleScrollPane.setViewportView(consolePane); consolePane.setText(""); setConsoleRight(); jConsole = new JConsole(System.out, consolePane); System.setOut(jConsole); System.setErr(jConsole); consolePane.setEditable(false); consolePane.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseReleased(java.awt.event.MouseEvent) */ public void mouseReleased(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { consolePane.add(consoleRight); consoleRight.show(e.getComponent(), e.getX(), e.getY()); } } }); } } { infoPanel = new JPanel(); inst.getContentPane().add(infoPanel, BorderLayout.SOUTH); infoPanel.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); infoPanel.setPreferredSize(new Dimension(784, 30)); infoPanel.setLayout(flowLayout); { { statusbar_count = new JTextPane(); infoPanel.add(statusbar_count); statusbar_count.setText( CONTEXT.getMessage("event.web.scan.statusbar.count", null, Locale.CHINA)); statusbar_count.setBackground(null); statusbar_count.setEditable(false); } { statusbar_count_value = new JTextPane(); infoPanel.add(statusbar_count_value); statusbar_count_value.setText(String.valueOf(SCAN_COUNT)); statusbar_count_value.setBackground(null); statusbar_count_value.setEditable(false); statusbar_count_value.setEnabled(false); } { programPID = new JTextPane(); infoPanel.add(programPID); programPID.setText("PID:"); programPID.setBackground(null); programPID.setEditable(false); } { programPID_value = new JTextPane(); infoPanel.add(programPID_value); programPID_value.setText(JvmPid.getPID()); programPID_value.setBackground(null); programPID_value.setEditable(false); programPID_value.setEnabled(false); } { memory = new JTextPane(); infoPanel.add(memory); memory.setText(CONTEXT.getMessage("gobal.gui.memory", null, Locale.CHINA)); memory.setBackground(null); memory.setEditable(false); } { memory_value = new JTextPane(); infoPanel.add(memory_value); memory_value.setText("0KB"); memory_value.setBackground(null); memory_value.setEditable(false); memory_value.setEnabled(false); MemoryListener memory = new MemoryListener(memory_value); memory.start(); } { runtime = new JTextPane(); infoPanel.add(runtime); runtime.setText(CONTEXT.getMessage("gobal.gui.runtime", null, Locale.CHINA)); runtime.setBackground(null); runtime.setEditable(false); } { runtime_value = new JTextPane(); infoPanel.add(runtime_value); runtime_value.setText("NULL"); runtime_value.setBackground(null); runtime_value.setEditable(false); runtime_value.setEnabled(false); } } } { shortcut = new JPanel(); inst.getContentPane().add(shortcut, BorderLayout.NORTH); shortcut.setSize(784, 35); shortcut.setPreferredSize(new Dimension(784, 35)); shortcut.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); shortcut.setLayout(new BorderLayout()); { eventText = new JTextPane(); shortcut.add(eventText, BorderLayout.WEST); eventText.setText(CONTEXT.getMessage("event.web.scan.name", null, Locale.CHINA) + ": "); eventText.setEditable(false); eventText.setEnabled(true); eventText.setBackground(null); eventText.setCaretColor(new Color(0, 0, 0)); } { eventTextField = new JTextField(); shortcut.add(eventTextField, BorderLayout.CENTER); eventTextField.setSize(500, 25); eventTextField.setText(""); eventTextField.setPreferredSize(new Dimension(500, 25)); eventTextField.setEditable(false); } { submit = new JButton(); shortcut.add(submit, BorderLayout.EAST); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setSize(new Dimension(75, 25)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { submitActionPerformed(evt); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } } }); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);//w w w . ja va 2 s .co m add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); flowLayout.setAlignOnBaseline(false); }
From source file:gdt.jgui.tool.JIconSelector.java
/** * The default constructor.// www. j a v a 2 s .c o m */ public JIconSelector() { FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 5, 5); flowLayout.setAlignOnBaseline(true); WrapLayout wrapLayout = new WrapLayout(FlowLayout.LEFT, 5, 5); wrapLayout.setAlignOnBaseline(true); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); panel = new JPanel(); panel.setLayout(wrapLayout); scrollPane = new JScrollPane(panel); add(scrollPane); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); }
From source file:netcap.JcaptureConfiguration.java
/** * ????/*from ww w .j a v a 2 s .c o m*/ * @return */ private JCheckBox getPromiscCheckBox() { FlowLayout checkBoxLayout = new FlowLayout(); checkBoxLayout.setAlignOnBaseline(true); JCheckBox checkBox = ViewModules.createCheckBox("???", checkBoxLayout); return checkBox; }
From source file:gtu._work.mvn.MavenRepositoryUI.java
private void initGUI() { try {//from ww w . ja v a2 s .c om { } 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:gtu._work.ui.DirectoryCompareUI.java
private void initGUI() { try {/* w ww .java 2 s.com*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jPanel2 = new JPanel(); BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.X_AXIS); jPanel2.setLayout(jPanel2Layout); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.setPreferredSize(new java.awt.Dimension(660, 36)); { leftDirText = new JTextArea(); leftDirText.setPreferredSize(leftDirText.getPreferredSize()); leftDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); JCommonUtil.jTextFieldSetFilePathMouseEvent(leftDirText, true); leftDirText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { @Override public void process(DocumentEvent event) { } })); jPanel2.add(leftDirText); JTextFieldUtil.setupDragDropFilePath(leftDirText, null); } { rightDirText = new JTextArea(); rightDirText.setPreferredSize(rightDirText.getPreferredSize()); rightDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); JCommonUtil.jTextFieldSetFilePathMouseEvent(rightDirText, true); rightDirText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { @Override public void process(DocumentEvent event) { } })); jPanel2.add(rightDirText); JTextFieldUtil.setupDragDropFilePath(rightDirText, null); } { executeBtn = new JButton(); jPanel2.add(executeBtn); jPanel2.add(getResetBtn()); executeBtn.setText("\u958b\u59cb\u6bd4\u5c0d"); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { compareStart(); } }); } } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(660, 362)); { dirCompareTable = new JTable(); // JTableUtil.defaultSetting(dirCompareTable); JTableUtil.defaultSetting_AutoResize(dirCompareTable); jScrollPane1.setViewportView(dirCompareTable); dirCompareTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { dirCompareTableMouseClicked(evt); } }); dirCompareTable.setModel(getDefaultTableModel()); } } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jPanel3Layout.setAlignOnBaseline(true); jPanel1.add(jPanel3, BorderLayout.SOUTH); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(843, 62)); { jLabel1 = new JLabel(); jPanel3.add(jLabel1); jLabel1.setText("\u526f\u6a94\u540d"); } { DefaultComboBoxModel extensionNameComboBoxModel = new DefaultComboBoxModel(); extensionNameComboBox = new JComboBox(); jPanel3.add(extensionNameComboBox); jPanel3.add(getDiffToolComboBox()); jPanel3.add(getJLabel2()); jPanel3.add(getSearchText()); jPanel3.add(getCompareStyleComboBox()); jPanel3.add(getResetQueryBtn()); addDiffMergeChkBox(); extensionNameComboBox.setModel(extensionNameComboBoxModel); { panel = new JPanel(); jTabbedPane1.addTab("New tab", null, panel, null); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); { lblCustomCommand = new JLabel("custom command"); panel.add(lblCustomCommand, "2, 2, right, default"); } { customCompareText = new JTextField(); customCompareText.setText( "\"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\" /base:\"%s\" /theirs:\"%s\""); panel.add(customCompareText, "4, 2, fill, default"); customCompareText.setColumns(10); } { configSaveBtn = new JButton(""); configSaveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { boolean configChange = false; String customCompareUrl = customCompareText.getText(); if (StringUtils.isNotBlank(customCompareUrl)) { configBean.getConfigProp().setProperty(CUSTOM_COMPARE_URL_KEY, customCompareUrl); configChange = true; } if (configChange) { configBean.store(); JCommonUtil._jOptionPane_showMessageDialog_info( "?!"); } } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); panel.add(configSaveBtn, "2, 36"); } } extensionNameComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { totalScanFiles(null); } }); } } } } pack(); this.setSize(864, 563); JCommonUtil.setJFrameIcon(getOwner(), "images/ico/file_merge.ico"); initConfigBean(); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.eobjects.datacleaner.windows.ResultWindow.java
@Override protected JComponent getWindowContent() { DCPanel panel = new DCPanel(WidgetUtils.BG_COLOR_DARK, WidgetUtils.BG_COLOR_DARK); panel.setLayout(new BorderLayout()); String bannerTitle = "Analysis results"; String datastoreName = getDatastoreName(); if (!StringUtils.isNullOrEmpty(datastoreName)) { bannerTitle = bannerTitle + " | " + datastoreName; if (_jobFilename != null) { bannerTitle = bannerTitle + " | " + _jobFilename.getName().getBaseName(); }/*from www .j a v a 2s.c o m*/ } final DCBannerPanel banner = new DCBannerPanel(imageManager.getImage("images/window/banner-results.png"), bannerTitle); banner.setLayout(null); _tabbedPane.bindTabTitleToBanner(banner); final FlowLayout layout = new FlowLayout(Alignment.RIGHT.getFlowLayoutAlignment(), 4, 36); layout.setAlignOnBaseline(true); banner.setLayout(layout); for (JComponent pluggableButton : _pluggableButtons) { banner.add(pluggableButton); } banner.add(_publishButton); banner.add(_exportButton); banner.add(_saveButton); banner.add(_cancelButton); banner.add(Box.createHorizontalStrut(10)); panel.add(banner, BorderLayout.NORTH); panel.add(_tabbedPane, BorderLayout.CENTER); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; int height = 550; if (screenHeight > 1000) { height = 900; } else if (screenHeight > 750) { height = 700; } int width = 750; if (screenWidth > 1200) { width = 1100; } else if (screenWidth > 1000) { width = 900; } panel.setPreferredSize(width, height); return panel; }