/** Creates the North JPanel with all the pixel location and color information */ private void createInfoPanel() { // create the info panel and set the layout JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); // create the font Font largerFont = new Font(infoPanel.getFont().getName(), infoPanel.getFont().getStyle(), 14); // create the pixel location panel JPanel locationPanel = createLocationPanel(largerFont); // create the color information panel JPanel colorInfoPanel = createColorInfoPanel(largerFont); // add the panels to the info panel infoPanel.add(BorderLayout.NORTH, locationPanel); infoPanel.add(BorderLayout.SOUTH, colorInfoPanel); // add the info panel pictureFrame.getContentPane().add(BorderLayout.NORTH, infoPanel); }
public TabbedEditor(org.colos.ejs.osejs.Osejs _ejs, String _type, String _header) { ejs = _ejs; defaultType = _type; defaultHeader = _header; defaultString = new String(res.getString(defaultHeader + ".Page")); MyActionListener al = new MyActionListener(); popupMenu = new PopupMenu(); customMenuItems(al); // Creates the top menu items // common menu items copyPage = createMenuItem("copyPage", defaultHeader, al); upPage = createMenuItem("upPage", defaultHeader, al); dnPage = createMenuItem("dnPage", defaultHeader, al); renamePage = createMenuItem("renamePage", defaultHeader, al); popupMenu.addSeparator(); togglePage = createMenuItem("togglePage", defaultHeader, al); removePage = createMenuItem("removePage", defaultHeader, al); JPanel firstPanel = createFirstPanel(); tabbedPanel = new JTabbedPane(); tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); tabbedPanel.add(popupMenu); // tabbedPanel.setPreferredSize (res.getDimension("TabbedEditor.PreferredSize")); tabbedPanel.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { if (OSPRuntime.isPopupTrigger(evt)) // SwingUtilities.isRightMouseButton(evt)) showMenu(evt.getComponent(), evt.getX(), evt.getY()); } }); cardLayout = new CardLayout(); finalPanel = new JPanel(cardLayout); finalPanel.add(tabbedPanel, "TabbedPanel"); finalPanel.add(firstPanel, "FirstPanel"); setFont(finalPanel.getFont()); Font font = InterfaceUtils.font(null, res.getString("Editor.TitleFont")); addPageMI.setFont(font); copyPage.setFont(font); upPage.setFont(font); dnPage.setFont(font); togglePage.setFont(font); removePage.setFont(font); renamePage.setFont(font); myFont = font.deriveFont(Font.PLAIN); showFirstPage(); }
@SuppressWarnings("serial") public JTableRenderer(final Object cell, final GraphComponent graphContainer) { this.cell = cell; this.graphContainer = graphContainer; this.graph = graphContainer.getGraph(); setLayout(new BorderLayout()); setBorder( BorderFactory.createCompoundBorder( ShadowBorder.getSharedInstance(), BorderFactory.createBevelBorder(BevelBorder.RAISED))); JPanel title = new JPanel(); title.setBackground(new Color(149, 173, 239)); title.setOpaque(true); title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); title.setLayout(new BorderLayout()); JLabel icon = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif"))); icon.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 1)); title.add(icon, BorderLayout.WEST); JLabel label = new JLabel(String.valueOf(graph.getLabel(cell))); label.setForeground(Color.WHITE); label.setFont(title.getFont().deriveFont(Font.BOLD, 11)); label.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2)); title.add(label, BorderLayout.CENTER); JPanel toolBar2 = new JPanel(); toolBar2.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 2)); toolBar2.setOpaque(false); JButton button = new JButton( new AbstractAction( "", new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "minimize.gif"))) { public void actionPerformed(ActionEvent e) { graph.foldCells(graph.isCellCollapsed(cell), false, new Object[] {cell}); ((JButton) e.getSource()) .setIcon( new ImageIcon( JTableRenderer.class.getResource( IMAGE_PATH + ((graph.isCellCollapsed(cell)) ? "maximize.gif" : "minimize.gif")))); } }); button.setPreferredSize(new Dimension(16, 16)); button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); button.setToolTipText("Collapse/Expand"); button.setOpaque(false); toolBar2.add(button); title.add(toolBar2, BorderLayout.EAST); add(title, BorderLayout.NORTH); // CellStyle style = // graph.getStylesheet().getCellStyle(graph.getModel(), // cell); // if (style.getStyleClass() == null) { table = new MyTable(); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if (graph.getModel().getChildCount(cell) == 0) { scrollPane.getViewport().setBackground(Color.WHITE); setOpaque(true); add(scrollPane, BorderLayout.CENTER); } scrollPane .getVerticalScrollBar() .addAdjustmentListener( new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { graphContainer.refresh(); } }); label = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "resize.gif"))); label.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR)); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(label, BorderLayout.EAST); add(panel, BorderLayout.SOUTH); ResizeHandler resizeHandler = new ResizeHandler(); label.addMouseListener(resizeHandler); label.addMouseMotionListener(resizeHandler); setMinimumSize(new Dimension(20, 30)); }