/** * Test custom title font and color use. * * <p>All values are passed in the constructor. */ public void interactiveCustomTitleFont() { Icon icon = XTestUtils.loadDefaultIcon(); assertNotNull("sanity: default icon loaded", icon); JPanel p = new JPanel(new BorderLayout()); final JXHeader header = new JXHeader( "MyBigUglyTitle", "this is a long test with veeeeeeeeeeeeeery looooooong wooooooooooooords", icon); header.setTitleFont(new Font("serif", Font.BOLD, 36)); header.setTitleForeground(Color.GREEN); p.add(header); p.setPreferredSize(new Dimension(400, 150)); JXFrame frame = wrapInFrame(p, "Titlefont lost on updateUI / word wrapping JXHeader"); Action action = new AbstractAction("updateUI") { public void actionPerformed(ActionEvent e) { header.updateUI(); } }; addAction(frame, action); Action tree = new AbstractAction("updateComponentTree") { public void actionPerformed(ActionEvent e) { SwingUtilities.updateComponentTreeUI(header); } }; addAction(frame, tree); addMessage(frame, "title font set on header"); show(frame); }
/** * Long description in header produces expected line-wrap in footer. * * <p>Note: the frame is not packed to simulate the appframework context. */ public void interactiveHTMLTextWrapLong() { // Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { // // public void eventDispatched(AWTEvent event) { // if (event.getID() != MouseEvent.MOUSE_MOVED) { // System.out.println("e:" + event); // } // }}, Long.MAX_VALUE); JXHeader header = createHeader(); JXHeader footer = new JXHeader(); footer.setTitle("Notes:"); String footerDescription = "<html>" + " <ul> " + " <li> code: in the jdnc-incubator, section kleopatra, package appframework." + " <li> technique: back the view by a shared presentation model " + " <li> technique: veto selection change until editing is completed " + " <li> issue: selection of tab should be vetoable " + " <li> issue: empty selection should disable editing pane " + " </ul> " + " </html>"; footer.setDescription(footerDescription); JComponent panel = new JPanel(new BorderLayout()); panel.add(header, BorderLayout.NORTH); // panel.add(new JScrollPane(table)); panel.add(footer, BorderLayout.SOUTH); // JXFrame frame = new JXFrame("html wrapping in SOUTH: long text in NORTH"); // frame.add(panel); JXFrame frame = wrapInFrame(panel, "html wrapping in SOUTH: long text in NORTH"); // addComponentOrientationToggle(frame); frame.setSize(800, 600); // show(frame); frame.setVisible(true); }
private JXHeader createHeader() { JXHeader header = new JXHeader(); header.setTitle("AlbumManager"); String headerLong = "An adaption from JGoodies Binding Tutorial in the context" + " of BeansBinding/AppFramework. " + "The Tabs show different styles of typical interaction " + "setups (in-place editing vs. dialog-editing). "; header.setDescription(headerLong); header.setIcon(XTestUtils.loadDefaultIcon()); return header; }
/** * Issue #403-swingx: JXHeader doesn't show custom values. * * <p>All values are passed in the constructor. */ public void interactiveCustomProperties() { Icon icon = XTestUtils.loadDefaultIcon(); assertNotNull("sanity: default icon loaded", icon); JPanel p = new JPanel(new BorderLayout()); JXHeader header = new JXHeader("MyTitle", "MyDescription", icon); header.setIconPosition(IconPosition.LEFT); JPanel px = new JPanel(new GridLayout(2, 1)); px.add(header); px.add(new JXHeader("MyTitle", "MyDescription", icon)); p.add(px); // added just to better visualize bkg gradient in the JXHeader. p.add(new JLabel("Reference component: JLabel"), BorderLayout.SOUTH); p.add(new JXLabel("Reference component: JXLabel"), BorderLayout.NORTH); showInFrame(p, "JXHeader with custom properties"); }
/** * Short description in header produces unexpected line wraps in footer. * * <p>Note: the frame is not packed to simulate the appframework context. */ public void interactiveHTMLTextWrapShort() { JXHeader header = new JXHeader(); header.setTitle("AlbumManager"); String headerShort = "An adaption from JGoodies Binding Tutorial in the context" + " of BeansBinding/AppFramework. "; header.setDescription(headerShort); header.setIcon(XTestUtils.loadDefaultIcon()); JXHeader footer = new JXHeader(); footer.setTitle("Notes:"); String footerDescription = "<html>" + " <ul> " + " <li> code: in the jdnc-incubator, section kleopatra, package appframework." + " <li> technique: back the view by a shared presentation model " + " <li> technique: veto selection change until editing is completed " + " <li> issue: selection of tab should be vetoable " + " <li> issue: empty selection should disable editing pane " + " </ul> " + " </html>"; footer.setDescription(footerDescription); JComponent panel = new JPanel(new BorderLayout()); panel.add(header, BorderLayout.NORTH); panel.add(footer, BorderLayout.SOUTH); JXFrame frame = new JXFrame("html wrapping in SOUTh: short text in NORTH"); frame.add(panel); frame.setSize(800, 400); frame.setVisible(true); }