/** @param frameName title name for frame */ public ShowSavedResults(String frameName) { super(frameName); aboutRes = new JTextArea( "Select a result set from" + "\nthose listed and details" + "\nof that analysis will be" + "\nshown here. Then you can" + "\neither delete or view those" + "\nresults using the buttons below."); aboutScroll = new JScrollPane(aboutRes); ss = new JScrollPane(sp); ss.getViewport().setBackground(Color.white); // resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1)); ClassLoader cl = getClass().getClassLoader(); rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif")); // results status resButtonStatus = new JPanel(new BorderLayout()); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); statusField = new JTextField(); statusField.setBorder(compound); statusField.setEditable(false); }
public void createColorPanel() { JPanel colorPanel = new JPanel(new GridLayout(0, 1)); int curRow = 0; for (int i = 0; i < colorString.length / 5; i++) { JPanel row = new JPanel(new GridLayout(1, 0, 2, 1)); row.setBorder(new EmptyBorder(2, 2, 2, 2)); for (int j = curRow; j < curRow + 5; j++) { final JLabel colorLabel = new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER); colorLabel.setOpaque(true); final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1); final Border lnb = BorderFactory.createLineBorder(Color.black); final Border cmb = BorderFactory.createCompoundBorder(lnb, emb); colorLabel.setBorder(emb); colorLabel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton btn = (JButton) getTarget(); Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor(); btn.setIcon(new ColoredIcon(selColor)); setVisible(false); btn.doClick(); oldLabel.setBackground(null); colorLabel.setBackground(new Color(150, 150, 200)); colorLabel.setBorder(emb); oldLabel = colorLabel; } public void mouseEntered(MouseEvent e) { colorLabel.setBorder(cmb); colorLabel.setBackground(new Color(150, 150, 200)); } public void mouseExited(MouseEvent e) { colorLabel.setBorder(emb); colorLabel.setBackground(null); } }); row.add(colorLabel); } colorPanel.add(row); curRow += row.getComponentCount(); // System.out.println(curRow); } add(colorPanel, BorderLayout.CENTER); // More Colors Button moreColors = new JButton(new ColorChooserAction((JButton) target)); moreColors.setText("More Colors..."); moreColors.setIcon(null); moreColors.setFont(new Font("Verdana", Font.PLAIN, 10)); // JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(moreColors); add(c, BorderLayout.SOUTH); }
protected void setUpSRSFrame(URL url, String search) throws IOException { if (BigPane.srsFrame == null) { BigPane.setUpSRSFrame((2 * desktop.getHeight()) / 3, desktop); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); JTextField statusField = new JTextField(); statusField.setBorder(compound); statusField.setEditable(false); BigPane.srsFrame.getContentPane().add(statusField, BorderLayout.SOUTH); } Annotation edPane = new Annotation(url); JScrollPane jsp = new JScrollPane(edPane); JTabbedPane jtab = (JTabbedPane) BigPane.srsFrame.getContentPane().getComponent(0); jtab.insertTab(search, null, jsp, null, 0); BigPane.srsFrame.setVisible(true); }
public InterpreterFrame() { super("Simple Lisp Interpreter"); // Create the menu menubar = buildMenuBar(); setJMenuBar(menubar); // Create the toolbar toolbar = buildToolBar(); // disable cut and copy actions cutAction.setEnabled(false); copyAction.setEnabled(false); // Setup text area for editing source code // and setup document listener so interpreter // is notified when current file modified and // when the cursor is moved. textView = buildEditor(); textView.getDocument().addDocumentListener(this); textView.addCaretListener(this); // set default key bindings bindKeyToCommand("ctrl C", "(buffer-copy)"); bindKeyToCommand("ctrl X", "(buffer-cut)"); bindKeyToCommand("ctrl V", "(buffer-paste)"); bindKeyToCommand("ctrl E", "(buffer-eval)"); bindKeyToCommand("ctrl O", "(file-open)"); bindKeyToCommand("ctrl S", "(file-save)"); bindKeyToCommand("ctrl Q", "(exit)"); // Give text view scrolling capability Border border = BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(3, 3, 3, 3), BorderFactory.createLineBorder(Color.gray)); JScrollPane topSplit = addScrollers(textView); topSplit.setBorder(border); // Create tabbed pane for console/problems consoleView = makeConsoleArea(10, 50, true); problemsView = makeConsoleArea(10, 50, false); tabbedPane = buildProblemsConsole(); // Plug the editor and problems/console together // using a split pane. This allows one to change // their relative size using the split-bar in // between them. splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSplit, tabbedPane); // Create status bar statusView = new JLabel(" Status"); lineNumberView = new JLabel("0:0"); statusbar = buildStatusBar(); // Now, create the outer panel which holds // everything together outerpanel = new JPanel(); outerpanel.setLayout(new BorderLayout()); outerpanel.add(toolbar, BorderLayout.PAGE_START); outerpanel.add(splitPane, BorderLayout.CENTER); outerpanel.add(statusbar, BorderLayout.SOUTH); getContentPane().add(outerpanel); // tell frame to fire a WindowsListener event // but not to close when "x" button clicked. setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(this); // set minimised icon to use setIconImage(makeImageIcon("spi.png").getImage()); // setup additional internal functions InternalFunctions.setup_internals(interpreter, this); // set default window size Component top = splitPane.getTopComponent(); Component bottom = splitPane.getBottomComponent(); top.setPreferredSize(new Dimension(100, 400)); bottom.setPreferredSize(new Dimension(100, 200)); pack(); // load + run user configuration file (if there is one) String homedir = System.getProperty("user.home"); try { interpreter.load(homedir + "/.simplelisp"); } catch (FileNotFoundException e) { // do nothing if file does not exist! System.out.println("Didn't find \"" + homedir + "/.simplelisp\""); } textView.grabFocus(); setVisible(true); // redirect all I/O to problems/console redirectIO(); // start highlighter thread highlighter = new DisplayThread(250); highlighter.setDaemon(true); highlighter.start(); }
public DOMTreeView(Document dom) { super("TreeWalkerView "); document = dom; // jtree UI setup jtree = new DOMTreeFull((Node) document); jtree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // Listen for when the selection changes, call nodeSelected(node) jtree.addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath path = (TreePath) e.getPath(); TreeNode treeNode = (TreeNode) path.getLastPathComponent(); if (jtree.getSelectionModel().isPathSelected(path)) nodeSelected(treeNode); } }); treeScroll = new JScrollPane(jtree); treeScroll.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("DOM Tree View"), BorderFactory.createEmptyBorder(4, 4, 4, 4))); JPanel urlPanel = new JPanel(); JLabel urlLabel = new JLabel("URL:"); urlTextField = new JTextField(50); urlTextField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source == urlTextField) { reloadJTree(urlTextField.getText()); } } }); urlPanel.add(urlLabel); urlPanel.add(urlTextField); JPanel selectedXPathPanel = new JPanel(); JLabel xpathLabel = new JLabel("XPath: "); selectedXPathTextField = new JTextField(50); selectedXPathTextField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source == selectedXPathTextField) { lookupByXPath(selectedXPathTextField.getText()); } } }); selectedXPathPanel.add(xpathLabel); selectedXPathPanel.add(selectedXPathTextField); JPanel lookupPanel = new JPanel(); JLabel lookupLabel = new JLabel("look up:"); lookupTextField = new JTextField(20); lookupTextField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source == lookupTextField) { lookup(lookupTextField.getText()); } } }); foundList = new JList(); foundList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); foundList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { Object source = evt.getSource(); if (source == foundList) { FoundItem fi = (FoundItem) foundList.getSelectedValue(); if (fi == null) return; jtree.setSelectionPath(fi.treePath); jtree.scrollPathToVisible(fi.treePath); } } }); JScrollPane foundScroll = new JScrollPane(foundList); foundScroll.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Nodes found"), BorderFactory.createEmptyBorder(4, 4, 4, 4))); // foundScroll.set JPanel queryPanel = new JPanel(); queryPanel.add(lookupLabel); queryPanel.add(lookupTextField); lookupPanel.setLayout(new BorderLayout()); lookupPanel.add(queryPanel, BorderLayout.NORTH); lookupPanel.add(foundScroll, BorderLayout.CENTER); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScroll, lookupPanel); splitPane.setContinuousLayout(true); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(400); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(urlPanel, BorderLayout.NORTH); mainPanel.add(selectedXPathPanel, BorderLayout.SOUTH); mainPanel.add(splitPane, BorderLayout.CENTER); // mainPanel.add(treeScroll, BorderLayout.CENTER); // mainPanel.add(lookupPanel, BorderLayout.EAST); getContentPane().add(mainPanel); }