public UserDirectoryDialog(int nBuild) { super("View Directories"); initBlink(); try { // UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" ); } catch (Exception exc) { System.out.println("Error loading L&F: " + exc); } AppIF appIf = Util.getAppIF(); if (appIf instanceof VAdminIF) m_adminIF = (VAdminIF) appIf; if (nBuild == BUILD_ALL) { JPanel left = new JPanel(); left.setOpaque(true); left.setLayout(new BorderLayout()); left.add(new ConstraintsPanel(), BorderLayout.CENTER); JPanel right = new JPanel(); right.setLayout(new BorderLayout()); right.setOpaque(true); // right.setBackground( Color.white ); JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin()); right.add(new JScrollPane(treeTable), BorderLayout.CENTER); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); pane.setContinuousLayout(true); pane.setOneTouchExpandable(true); getContentPane().add(pane, BorderLayout.CENTER); } m_mlTxf = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (timer != null) timer.cancel(); if (e.getSource() instanceof JTextField) { JTextField txf2 = (JTextField) e.getSource(); String strTxt = txf2.getText(); if (strTxt != null && strTxt.equals(INFOSTR)) txf2.setText(""); } } }; }
public JPanel makeFileTable() { JPanel right = new JPanel(); right.setLayout(new BorderLayout()); right.setOpaque(true); // right.setBackground( Color.white ); JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin()); right.add(new JScrollPane(treeTable), BorderLayout.CENTER); return right; }
public GLDemo() { super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false); DisplayOptions.addChangeListener(this); contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); gradientPanel = createGradientPanel(); contentPane.add(gradientPanel, BorderLayout.CENTER); checkBox = new JCheckBox("Transparent", true); checkBox.setActionCommand("transparancy"); checkBox.addActionListener(this); optionsPan = new JPanel(); optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false)); optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); optionsPan.add(checkBox); runButton = new JToggleButton("Run"); runButton.setActionCommand("run"); runButton.setSelected(false); runButton.addActionListener(this); optionsPan.add(runButton); getContentPane().add(optionsPan, BorderLayout.SOUTH); setSize(300, 300); setLocation(300, 300); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting new Thread( new Runnable() { public void run() { stop(); } }) .start(); } }); setVisible(false); }
public static JPanel createGradientPanel() { JPanel gradientPanel = new JPanel() { Color c = Util.getBgColor(); public void paintComponent(Graphics g) { ((Graphics2D) g) .setPaint( new GradientPaint(0, 0, c.brighter(), getWidth(), getHeight(), c.darker())); g.fillRect(0, 0, getWidth(), getHeight()); } }; gradientPanel.setLayout(new BorderLayout()); return gradientPanel; }
/** Constructor */ public WPart11Dialog() { super(null); setVisible(false); m_pnlDisplay = new JPanel(); m_pcsTypesMgr = new PropertyChangeSupport(this); JScrollPane spDisplay = new JScrollPane(m_pnlDisplay); m_pnlDisplay.setLayout(new WGridLayout(0, 2)); addComp(spDisplay); initBlink(); buttonPane.removeAll(); // Add the buttons to the panel with space between buttons. m_btnChecksum = new JButton("Make new checksum"); buttonPane.add(m_btnChecksum); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(validateButton); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(closeButton); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(abandonButton); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(helpButton); setHelpEnabled(false); closeButton.setActionCommand("close"); closeButton.addActionListener(this); validateButton.setActionCommand("validate"); validateButton.addActionListener(this); abandonButton.setActionCommand("cancel"); abandonButton.addActionListener(this); helpButton.setActionCommand("help"); helpButton.addActionListener(this); m_btnChecksum.setActionCommand("checksum"); m_btnChecksum.addActionListener(this); setCloseEnabled(true); setAbandonEnabled(true); setTitle("Configuration"); setLocation(300, 500); setResizable(true); setSize(450, 300); }
/** * Builds the components from the file and displays it. * * @param strFile the file to be read. */ public void build(int nType, String strFile, String strhelpfile) { m_nType = nType; m_strPath = (strFile != null) ? FileUtil.openPath(strFile) : ""; m_strHelpFile = strhelpfile; boolean bValidate = false; boolean bChecksum = false; if (nType == CONFIG) { setTitle("Configuration"); buildConfig(); } else { JComponent compDisplay = null; if (nType == DEFAULT) { m_pnlAccPolicy = new AccPolicyPanel(m_strPath); compDisplay = m_pnlAccPolicy; setTitle("Password Configuration"); } else if (nType == CHECKSUM) { m_pnlChecksum = new ChecksumPanel(m_strPath); compDisplay = m_pnlChecksum; setTitle("Checksum Configuration"); bValidate = true; bChecksum = true; } else { setTitle("Perform System Validation"); compDisplay = new JTextArea(); ((JTextArea) compDisplay).setEditable(false); bValidate = true; doBlink(); } m_pnlDisplay.removeAll(); m_pnlDisplay.setLayout(new BorderLayout()); m_pnlDisplay.add(compDisplay, BorderLayout.CENTER); setVisible(true); } validateButton.setVisible(bValidate); // abandonButton.setVisible(!bValidate); setAbandonEnabled(bValidate); m_btnChecksum.setVisible(bChecksum); }
public void buildConfig() { BufferedReader in = WFileUtil.openReadFile(m_strPath); String strLine = null; if (in == null) { Messages.postError("Error opening file " + m_strPath); return; } try { m_pnlDisplay.removeAll(); m_pnlDisplay.setLayout(new WGridLayout(0, 2)); m_aListComp.clear(); while ((strLine = in.readLine()) != null) { if (strLine.startsWith("#") || strLine.startsWith("%") || strLine.startsWith("@")) continue; StringTokenizer sTokLine = new StringTokenizer(strLine, File.pathSeparator); createJComps(sTokLine); } setVisible(true); } catch (Exception e) { // e.printStackTrace(); Messages.writeStackTrace(e); } }