public void actionPerformed(ActionEvent e) { for (int k = 0; k <= 4; k++) { // 先將全部顏色按鈕還原為浮凸狀 btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); if (e.getSource() == btnCr[k]) { pane.setBackground(cr[k]); // 被點按的顏色按鈕呈凹陷狀 btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } } }
public StatusPanel(JLabel label) { super(); this.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); this.setLayout(new FlowLayout(FlowLayout.LEFT)); this.setBackground(bgColor); this.add(new JLabel("Status: ")); this.add(label); label.setFont(new Font("Monospaced", Font.BOLD, 14)); }
Graphic(int width, int height, int ux, int uy) { frameWidth = width; frameHeight = height; unityX = ux; unityY = uy; this.setOpaque(true); this.setPreferredSize(new Dimension(frameWidth, frameHeight)); this.setBorder(BorderFactory.createBevelBorder(1)); instance = this; function = new FunctionGraphic(new MyTestFunction()); }
Title(String title) { super(); setText(title); setHorizontalAlignment(SwingConstants.CENTER); setBorder( BorderFactory.createBevelBorder( BevelBorder.RAISED, UIManager.getColor("activeCaptionBorder"), UIManager.getColor("inactiveCaptionBorder"))); // Forward mouse events to titlebar for moves. addMouseMotionListener( new MouseMotionListener() { public void mouseDragged(MouseEvent e) { forwardEventToParent(e); } public void mouseMoved(MouseEvent e) { forwardEventToParent(e); } }); addMouseListener( new MouseListener() { public void mouseClicked(MouseEvent e) { forwardEventToParent(e); } public void mousePressed(MouseEvent e) { forwardEventToParent(e); } public void mouseReleased(MouseEvent e) { forwardEventToParent(e); } public void mouseEntered(MouseEvent e) { forwardEventToParent(e); } public void mouseExited(MouseEvent e) { forwardEventToParent(e); } }); }
CGFrame() { pane.setBounds(20, 20, 200, 200); // 設定pane畫布的框線厚度為 4 像素 pane.setBorder(BorderFactory.createLineBorder(Color.blue, 4)); add(pane); for (int i = 0; i <= 4; i++) { btnCr[i] = new JButton(); btnCr[i].setBounds(21 + i * 42, 230, 30, 30); // 設定顏色按鈕目前全部呈浮凸狀 btnCr[i].setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); btnCr[i].setBackground(cr[i]); add(btnCr[i]); btnCr[i].addActionListener(this); } setTitle("點選顏色"); setLayout(null); setBounds(50, 50, 248, 310); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); }
/** initialize GUI components */ private JPanel initComponents() { JPanel panel = new JPanel(); JScrollPane jScrollPane1 = new JScrollPane(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); jScrollPane1.setViewportView(jEditorPaneAbout); jButtonOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButtonOkActionPerformed(e); } }); jButtonOk.setText("OK"); jLabel1.setText("Application:"); jLabel2.setText("Version:"); jTextFieldApplication.setBackground(new Color(255, 255, 255)); jTextFieldApplication.setEditable(false); jTextFieldApplication.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); jTextFieldVersion.setBackground(new Color(255, 255, 255)); jTextFieldVersion.setEditable(false); jTextFieldVersion.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); jEditorPaneAbout.setEditable(false); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING) .add( jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE) .add( layout .createSequentialGroup() .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout .LEADING) .add( jTextFieldApplication, org.jdesktop.layout.GroupLayout .PREFERRED_SIZE, 145, org.jdesktop.layout.GroupLayout .PREFERRED_SIZE) .add(jLabel1)) .add(4, 4, 4) .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout .LEADING) .add(jLabel2) .add( jTextFieldVersion, org.jdesktop.layout.GroupLayout .DEFAULT_SIZE, 140, Short.MAX_VALUE))))) .add( layout .createSequentialGroup() .add(106, 106, 106) .add( jButtonOk, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) .add(94, 94, 94))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(jLabel2)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add( jTextFieldApplication, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add( jTextFieldVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonOk) .addContainerGap())); return panel; }
private void jbInit() throws Exception { //////////////////////////////////////////////////////// // Init LAF //////////////////////////////////////////////////////// ButtonGroup grpLAF = new ButtonGroup(); ActionListener lsnLAF = new ActionListener() { public void actionPerformed(ActionEvent evt) { int iIndex = mvtLAFItem.indexOf(evt.getSource()); if (iIndex >= 0) changeLAF(iIndex); } }; //////////////////////////////////////////////////////// UIManager.LookAndFeelInfo laf = new UIManager.LookAndFeelInfo( "Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel"); marrLaf = UIManager.getInstalledLookAndFeels(); int iIndex = 0; while (iIndex < marrLaf.length && !marrLaf[iIndex].getName().equals(laf.getName())) iIndex++; if (iIndex >= marrLaf.length) { UIManager.installLookAndFeel(laf); marrLaf = UIManager.getInstalledLookAndFeels(); } for (iIndex = 0; iIndex < marrLaf.length; iIndex++) { JMenuItem mnu = new JRadioButtonMenuItem(marrLaf[iIndex].getName()); mnu.addActionListener(lsnLAF); mvtLAFItem.addElement(mnu); mnuUI.add(mnu); grpLAF.add(mnu); } mnuUI.addSeparator(); //////////////////////////////////////////////////////// // Init language //////////////////////////////////////////////////////// ButtonGroup grpLanguage = new ButtonGroup(); ActionListener lsnLanguage = new ActionListener() { public void actionPerformed(ActionEvent e) { int iIndex = mvtLanguageItem.indexOf(e.getSource()); if (iIndex >= 0) changeDictionary((String) mvtLanguage.elementAt(iIndex)); } }; //////////////////////////////////////////////////////// String[] str = MonitorDictionary.getSupportedLanguage(); for (iIndex = 0; iIndex < str.length; iIndex++) { JMenuItem mnu = new JRadioButtonMenuItem(MonitorDictionary.getDictionary(str[iIndex]).getLanguage()); mnu.addActionListener(lsnLanguage); mvtLanguage.addElement(str[iIndex]); mvtLanguageItem.addElement(mnu); mnuUI.add(mnu); grpLanguage.add(mnu); } //////////////////////////////////////////////////////// // Add to main menu //////////////////////////////////////////////////////// mnuMain.removeAll(); mnuMain.add(mnuSystem); mnuSystem.add(mnuSystem_Login); mnuSystem.add(mnuSystem_ChangePassword); mnuSystem.addSeparator(); mnuSystem.add(mnuSystem_StopServer); mnuSystem.add(mnuSystem_EnableThreads); mnuMain.add(mnuUI); mnuMain.add(mnuHelp); mnuHelp.add(mnuHelp_About); //////////////////////////////////////////////////////// mnuMain.add(chkVietnamese); mnuMain.add(lblStatus); //////////////////////////////////////////////////////// pnlThread.setTabPlacement(JTabbedPane.LEFT); pnlThread.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); //////////////////////////////////////////////////////// tblUser.addColumn("", 1, false); tblUser.addColumn("", 2, false, Global.FORMAT_DATE_TIME); tblUser.addColumn("", 3, false); //////////////////////////////////////////////////////// JPanel pnlMessage = new JPanel(); pnlMessage.setLayout(new GridBagLayout()); pnlMessage.add( new JScrollPane(txtBoard), new GridBagConstraints( 0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlMessage.add( txtMessage, new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlMessage.add( btnSend, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); txtBoard.setEditable(false); txtBoard.setAutoscrolls(true); txtBoard.setContentType("text/html"); clearAll(txtBoard); //////////////////////////////////////////////////////// JPanel pnlUserButton = new JPanel(new GridLayout(1, 2, 4, 4)); pnlUserButton.add(btnKick); pnlUserButton.add(btnRefresh); //////////////////////////////////////////////////////// JPanel pnlManager = new JPanel(new GridBagLayout()); pnlManager.add( new JScrollPane(tblUser), new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlManager.add( pnlUserButton, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 2, 4, 2), 0, 0)); //////////////////////////////////////////////////////// pnlUser.setDividerLocation(320); pnlUser.setLeftComponent(pnlManager); pnlUser.setRightComponent(pnlMessage); pnlUser.setOneTouchExpandable(true); //////////////////////////////////////////////////////// setOrientation(JSplitPane.VERTICAL_SPLIT); setOneTouchExpandable(true); pnlThread.setVisible(false); pnlUser.setVisible(false); setTopComponent(pnlThread); setBottomComponent(pnlUser); //////////////////////////////////////////////////////// pmn.add(mnuSelectAll); pmn.addSeparator(); pmn.add(mnuClearSelected); pmn.add(mnuClearAll); //////////////////////////////////////////////////////// setBorder(BorderFactory.createEmptyBorder()); pnlUser.setBorder(BorderFactory.createEmptyBorder()); pnlManager.setBorder( BorderFactory.createBevelBorder( javax.swing.border.BevelBorder.RAISED, Color.white, UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"))); pnlMessage.setBorder( BorderFactory.createBevelBorder( javax.swing.border.BevelBorder.RAISED, Color.white, UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"))); //////////////////////////////////////////////////////// Skin.applySkin(mnuMain); Skin.applySkin(tblUser); Skin.applySkin(pmn); Skin.applySkin(this); //////////////////////////////////////////////////////// // Default setting //////////////////////////////////////////////////////// Hashtable prt = null; try { prt = Global.loadHashtable(Global.FILE_CONFIG); } catch (Exception e) { prt = new Hashtable(); } changeLAF(Integer.parseInt(StringUtil.nvl(prt.get("LAF"), "0"))); changeDictionary(StringUtil.nvl(prt.get("Language"), "VN")); Skin.LANGUAGE_CHANGE_LISTENER = this; MonitorProcessor.setRootObject(this); updateKeyboardUI(); //////////////////////////////////////////////////////// // Event handler //////////////////////////////////////////////////////// tblUser.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) btnKick.doClick(); } }); //////////////////////////////////////////////////////// btnRefresh.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { try { DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); DDTP response = channel.sendRequest("ThreadProcessor", "queryUserList", request); if (response != null) { tblUser.setData((Vector) response.getReturn()); if (mstrChannel != null) removeUser(mstrChannel); } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// btnKick.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { int iSelected = tblUser.getSelectedRow(); if (iSelected < 0) return; int iResult = MessageBox.showConfirmDialog( pnlThread, mdic.getString("ConfirmKick"), Global.APP_NAME, MessageBox.YES_NO_OPTION); if (iResult == MessageBox.NO_OPTION) return; try { String strChannel = (String) tblUser.getRow(iSelected).elementAt(0); DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); request.setString("strChannel", strChannel); DDTP response = channel.sendRequest("ThreadProcessor", "kickUser", request); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// txtMessage.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { btnSend.doClick(); } }); //////////////////////////////////////////////////////// btnSend.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { if (txtMessage.getText().length() == 0) return; try { DDTP request = new DDTP(); request.setString("strMessage", txtMessage.getText()); channel.sendRequest("ThreadProcessor", "sendMessage", request); txtMessage.setText(""); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// mnuClearAll.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { clearAll(txtBoard); } }); //////////////////////////////////////////////////////// mnuClearSelected.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { txtBoard.setEditable(true); txtBoard.replaceSelection(""); txtBoard.setEditable(false); } }); //////////////////////////////////////////////////////// mnuSelectAll.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { txtBoard.requestFocus(); txtBoard.selectAll(); } }); //////////////////////////////////////////////////////// txtBoard.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getButton() == e.BUTTON3) pmn.show(txtBoard, e.getX(), e.getY()); } }); //////////////////////////////////////////////////////// mnuSystem_Login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { login(); } }); //////////////////////////////////////////////////////// mnuSystem_ChangePassword.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { changePassword(); } }); //////////////////////////////////////////////////////// mnuSystem_StopServer.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopServer(); } }); //////////////////////////////////////////////////////// mnuSystem_EnableThreads.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { manageThreads(); } }); //////////////////////////////////////////////////////// mnuHelp_About.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { WindowManager.centeredWindow(new DialogAbout(PanelThreadManager.this)); } }); //////////////////////////////////////////////////////// chkVietnamese.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { switchKeyboard(); } }); }
public SceneLayoutApp() { super(); new Pair(); final JFrame frame = new JFrame("Scene Layout"); final JPanel panel = new JPanel(new BorderLayout()); frame.setContentPane(panel); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setMaximumSize(screenSize); frame.setSize(screenSize); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JMenuBar mb = new JMenuBar(); frame.setJMenuBar(mb); final JMenu jMenu = new JMenu("File"); mb.add(jMenu); mb.add(new JMenu("Edit")); mb.add(new JMenu("Help")); JMenu menu = new JMenu("Look and Feel"); // // Get all the available look and feel that we are going to use for // creating the JMenuItem and assign the action listener to handle // the selection of menu item to change the look and feel. // UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < lookAndFeelInfos.length; i++) { final UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i]; JMenuItem item = new JMenuItem(lookAndFeelInfo.getName()); item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { // // Set the look and feel for the frame and update the UI // to use a new selected look and feel. // UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); SwingUtilities.updateComponentTreeUI(frame); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } catch (UnsupportedLookAndFeelException e1) { e1.printStackTrace(); } } }); menu.add(item); } mb.add(menu); jMenu.add(new JMenuItem(new scene.action.QuitAction())); panel.add(new JScrollPane(desktopPane), BorderLayout.CENTER); final JToolBar bar = new JToolBar(); panel.add(bar, BorderLayout.NORTH); final JComboBox comboNewWindow = new JComboBox( new String[] {"320:180", "320:240", "640:360", "640:480", "1280:720", "1920:1080"}); comboNewWindow.addActionListener(new CreateSceneWindowAction()); comboNewWindow.setBorder(BorderFactory.createTitledBorder("Create New Window")); bar.add(comboNewWindow); bar.add( new AbstractAction("Progress Bars") { /** Invoked when an action occurs. */ @Override public void actionPerformed(ActionEvent e) { new ProgressBarAnimator(); } }); bar.add( new AbstractAction("Sliders") { /** Invoked when an action occurs. */ @Override public void actionPerformed(ActionEvent e) { new SliderBarAnimator(); } }); final JCheckBox permaViz = new JCheckBox(); permaViz.setText("Show the dump window"); permaViz.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); dumpWindow = new JInternalFrame("perma dump window"); dumpWindow.setContentPane(new JScrollPane(permText)); permaViz.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dumpWindow.setVisible(permaViz.isSelected()); } }); comboNewWindow.setMaximumSize(comboNewWindow.getPreferredSize()); permaViz.setSelected(false); bar.add(new CreateWebViewV1Action()); bar.add(new CreateWebViewV2Action()); bar.add(permaViz); desktopPane.add(dumpWindow); dumpWindow.setSize(400, 400); dumpWindow.setResizable(true); dumpWindow.setClosable(false); dumpWindow.setIconifiable(false); final JMenuBar m = new JMenuBar(); final JMenu cmenu = new JMenu("Create"); m.add(cmenu); final JMenuItem menuItem = new JMenuItem( new AbstractAction("new") { @Override public void actionPerformed(ActionEvent e) { Runnable runnable = new Runnable() { public void run() { Object[] in = (Object[]) XSTREAM.fromXML(permText.getText()); final JInternalFrame ff = new JInternalFrame(); final ScenePanel c = new ScenePanel(); ff.setContentPane(c); desktopPane.add(ff); final Dimension d = (Dimension) in[0]; c.setMaximumSize(d); c.setPreferredSize(d); ff.setSize(d.width + 50, d.height + 50); ScenePanel.panes.put(c, (List<Pair<Point, ArrayList<URL>>>) in[1]); c.invalidate(); c.repaint(); ff.pack(); ff.setClosable(true); ff.setMaximizable(false); ff.setIconifiable(false); ff.setResizable(false); ff.show(); } }; SwingUtilities.invokeLater(runnable); } }); cmenu.add(menuItem); // JMenuBar menuBar = new JMenuBar(); // getContentPane().add(menuBar); dumpWindow.setJMenuBar(m); frame.setVisible(true); }
@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)); }