TOPMOST style of a JFrame

Hello,
How could I create a JFrame with TOPMOST style ??
The frame must appear always on top of all windows, but not get the focus.
Any idea ??
[]'s
Rodrigo.

hmm,
sounds like a os specific task.
To stop a window getting the focus you can try
setFocusableWindowState(boolean focusableWindowState)again the member funtion of window:
toFront()will put your window to the front. I spose you could listen for the
appropriate event and call toFront(), but don't know how ugly it will
be.
It appears that the behaviour of toFront() is os specific and can
change based on what the os will allow. you will have to experiment.
James.

Similar Messages

  • Designing JFrame Application in better way

    I am going to start the design of a Kiosk Based Application which consists of nearly dozens of screen and the application must be full screen and undecorated. In this situation what will be the best GUI design strategy?
    1) I have designed 3-4 screens using MVC style which uses JFrame. But while moving from one JFrame screen to another it flickers and shows the background and the switching is slow.
    2) Can I use JPanel in each screen design (this JPanel will have GUI for one screen) and set them visible as per the condition on single JFrame. Will this technique will be efficient or can I face any problem in future due to design of GUI only on one JFrame.

    This is the demonstration code on which I am working.
    In this application while moving from second to third screen flickering occurs while in other case the transition is smoother the problem is between second and third frame. How to avoid this, any tick? or by adding sleep?
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.HashMap;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class FrameExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    Controller      viewController      = new Controller();
                    MainView      main                = new MainView(viewController);
                    DetailView      detail                = new DetailView(viewController);
                    ThirdView      Third_Screen     = new ThirdView(viewController);
                    viewController.showView("Main");
        static class Controller {
            HashMap<String,JFrame> views;
            public Controller(){
                views = new HashMap<String,JFrame>();
            public void registerView(String name, JFrame view){
                views.put(name,view);
            public void showView(String name){
                if (views.containsKey(name)){
                    for (String key : views.keySet()){
                        views.get(key).setVisible(key.equals(name));
        static class MainView extends JFrame {
            final Controller viewController;
            public MainView(Controller controller){
                super();
                this.viewController = controller;
                setTitle("Main");
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                getContentPane().setLayout(null);
                JButton button = new JButton("Frame 1--Show Detail");
                button.setBounds(300,300,160,80);
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                     try{
                     viewController.showView("Detail");                                 
                    //Thread.currentThread().sleep(100);               
                    }catch(Exception e1){}
                getContentPane().add(button, BorderLayout.SOUTH);
                setSize(1024, 786);
                setUndecorated(true);
                viewController.registerView(getTitle(), this);
        static class DetailView extends JFrame {
            final Controller viewController;
            public DetailView(Controller controller){
                super();
                this.viewController = controller;
                setTitle("Detail");
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                getContentPane().setLayout(null);
                JButton button = new JButton("Frame 2--Show ThirdView");
                button.setBounds(300,300,160,80);
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        try{                         
                     viewController.showView("Third_Screen");                 
                   // Thread.currentThread().sleep(400);
                    }catch(Exception e2){}
                getContentPane().add(button, BorderLayout.SOUTH);
                setSize(1024, 786);
                setUndecorated(true);
                viewController.registerView(getTitle(), this);
        static class ThirdView extends JFrame {
            final Controller viewController;
            public ThirdView(Controller controller){
                super();
                this.viewController = controller;
                setTitle("Third_Screen");
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                getContentPane().setLayout(null);
                JButton button = new JButton("Frame 3--Show Main");
                button.setBounds(300,300,160,80);
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        try{                         
                     viewController.showView("Main");                 
                    //Thread.currentThread().sleep(100);
                    }catch(Exception e2){}
                getContentPane().add(button, BorderLayout.SOUTH);
                setSize(1024, 786);
                setUndecorated(true);
                viewController.registerView(getTitle(), this);
    }

  • A small Java Problem for java Experts

    Hi Guys...
    I have a small problem with my program...
    Tha program I am using consist of several frames where one invokes the other in row.
    These are the classes I am using:
    the FIRST class://THIS CLASS IS NOT COMPLETE
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * LabelDemo.java is a 1.4 application that needs one other file:
    * images/middle.gif
    public class CSVloader extends JPanel implements ActionListener {
         ImageIcon icon ;
         JLabel label;
    JButton theButton1;
    JButton saveButton;
    JButton displayButton;
    JButton displayStyleButton;
    JFileChooser fc;
    final boolean shouldFill = true;
    final boolean shouldWeightX = true;
    public CSVloader() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gridbag);
    if (shouldFill) {
    //natural height, maximum width
    c.fill = GridBagConstraints.HORIZONTAL;
    theButton1 = new JButton("Choose source File");
    theButton1.addActionListener(this);
    if (shouldWeightX) {
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(theButton1, c);
    add(theButton1);
    displayStyleButton = new JButton("CSV Display style");
    displayStyleButton.addActionListener(this);
    c.gridx = 0;
    c.gridy = 2;
    gridbag.setConstraints(displayStyleButton, c);
    add(displayStyleButton);
    displayButton = new JButton("Display");
    displayButton.addActionListener(this);
    c.gridx = 1;
    c.gridy = 0;
    gridbag.setConstraints(displayButton, c);
    add(displayButton);
    saveButton = new JButton("Save");
    saveButton.addActionListener(this);
    c.gridx = 0;
    c.gridy = 1;
    gridbag.setConstraints(saveButton, c);
    add(saveButton);
    icon = new ImageIcon("c:/applets/CSVlogo.gif");
    //Create the first label.
    label = new JLabel(icon);
    c.ipady = 45; //make this component tall
    c.weightx = 0.0;
    c.gridwidth = 1;
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(label, c);
    add(label);
    fc = new JFileChooser();
    public Dimension getDimension(int hight, int width) {
    Dimension theDimension = new Dimension(hight,width);
    return theDimension;
    public void actionPerformed(ActionEvent e) {
    //Handle open button action.
    if (e.getSource() == theButton1) {
    int returnVal = fc.showOpenDialog(CSVloader.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    //This is where a real application would open the file.
    //Handle save button action.
    } else
    if (e.getSource() == displayButton) {
         try {
    Runtime.getRuntime().exec("cmd /c start " + "c:\\applets\\displayData.html");
    catch(IOException io)
    System.err.println("Caught IOException: " +
         io.getMessage());
    }else
    if (e.getSource() == displayStyleButton)
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("Display Style");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    DisplayStyle newContentPane = new DisplayStyle();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    else
    if (e.getSource() == saveButton) {
         int returnVal = fc.showOpenDialog(CSVloader.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File saveFile = fc.getSelectedFile();
    //This is where a real application would open the file.
    public static void main(String[] args) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("LabelDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    CSVloader newContentPane = new CSVloader();
    newContentPane.setBackground(Color.WHITE);
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    // Runtime.getRuntime().exec("cmd /c start " + "....\\docs\\index.html");
    this is the SECOND class:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DisplayStyle extends JPanel implements ActionListener{
         public static final int FIRST_OPTION = 0;
         public static final int SECOND_OPTION = 1;
         public static final int THIRD_OPTION = 2;
         public static final int THE_BUTTON_OPTION =3;
    public static final int ERROR = -1;
         public int selectedOption = ERROR;
         static String table = "Table";
         static String tableNoBorders = "Table without Borders";
         static String highlightedTable = "Highlighted Table without Borders";
         public JRadioButton theTable;
         public JRadioButton theTable2;
         public JRadioButton theTable3;
         public JButton theButton;
         public String theName;
         public DisplayStyle ()
         theTable = new JRadioButton(table);
         theTable.setActionCommand(""+ FIRST_OPTION);
         theTable.addActionListener(this);
         theTable.setMnemonic(KeyEvent.VK_B);     
    theTable.setSelected(true);
    theTable2 = new JRadioButton(tableNoBorders);
    theTable2.setActionCommand(""+ SECOND_OPTION);
         theTable2.addActionListener(this);
         theTable2.setMnemonic(KeyEvent.VK_B);     
    theTable3 = new JRadioButton(highlightedTable);
    theTable3.setActionCommand(""+ THIRD_OPTION);
         theTable3.addActionListener(this);
         theTable3.setMnemonic(KeyEvent.VK_B);     
    theButton = new JButton("OK");
    theButton.setActionCommand(""+ THE_BUTTON_OPTION);
    theButton.addActionListener(this);
         ButtonGroup group = new ButtonGroup();
    group.add(theTable);
    group.add(theTable2);
    group.add(theTable3);
    JLabel theLabel = new JLabel("Choose the style of Display");
    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(theLabel);
    radioPanel.add(theTable);
    radioPanel.add(theTable2);
    radioPanel.add(theTable3);
    radioPanel.add(theButton);
    add(radioPanel, BorderLayout.LINE_START);
         public void actionPerformed (ActionEvent e) {
         if(e.getSource() == theButton)
         JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame1 = new JFrame("The Format");
    frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Formats newFormat = new Formats();
    newFormat.setOpaque(true); //content panes must be opaque
    frame1.setContentPane(newFormat);
    //Display the window.
    frame1.pack();
    frame1.setVisible(true);
         selectedOption = Integer.parseInt(e.getActionCommand().trim());
         public DisplayStyle getInstance(){
              return this;      
    this is the THIRD class:
    mport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Formats extends JPanel implements ActionListener{
         public static final int FIRST_OPTION = 0;
         public static final int SECOND_OPTION = 1;
         public static final int THIRD_OPTION = 2;
         public static final int FOURTH_OPTION = 4;
         public static final int THE_BUTTON_OPTION =3;
    public static final int ERROR = -1;
         public int selectedOption = ERROR;
         static String standardFormat = "Date first";
         static String timeFirstFormat = "Time First";
         static String typeFirstFormat = "Type of call first";
         static String extFirstFormat = "Extension first";
         public JButton theButton;
         public JRadioButton theStandardButton1 ;
         public JRadioButton theTimeButton;
         public JRadioButton theTypeButton;
         public JRadioButton theExtButton ;
         public Formats()
    theStandardButton1 = new JRadioButton(standardFormat);
         theStandardButton1.setMnemonic(KeyEvent.VK_B);     
    theStandardButton1.setSelected(true);
         theTimeButton = new JRadioButton(timeFirstFormat);
         theTimeButton.setMnemonic(KeyEvent.VK_B);     
    theTypeButton = new JRadioButton(typeFirstFormat);
         theTypeButton .setMnemonic(KeyEvent.VK_B);     
    theExtButton = new JRadioButton(extFirstFormat);
         theExtButton.setMnemonic(KeyEvent.VK_B);     
         ButtonGroup group = new ButtonGroup();
    group.add(theStandardButton1);
    group.add(theTimeButton);
    group.add(theTypeButton);
    group.add(theExtButton);
    JLabel newLabel = new JLabel("Choose the Format type for the data to be displayed");
    theButton = new JButton("OK");
    theButton.addActionListener(this);
    theButton.setActionCommand("" + THE_BUTTON_OPTION);
    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(newLabel);
    radioPanel.add(theStandardButton1);
    radioPanel.add(theTimeButton);
    radioPanel.add(theTypeButton);
    radioPanel.add(theExtButton);
    radioPanel.add(theButton);
    add(radioPanel, BorderLayout.LINE_START);      
         public void actionPerformed (ActionEvent e) {
         if(e.getSource() == theButton)
         JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("The Font");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    TableFonts newFont = new TableFonts();
    newFont.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newFont);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
         selectedOption = Integer.parseInt(e.getActionCommand().trim());
         public Formats getInstance(){
              return this;      
    and the last class:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TableFonts extends JPanel implements ActionListener{
         static String standardFont = "Standard Font";
         static String boldFont = "Bold Font";
         static String italicFont = "Italic Font";
         static String monospaceFont = "Monospace Font";
         public      JRadioButton theStandardButton ;
         public JRadioButton theBoldButton;
         public JRadioButton theItalicButton;
         public JRadioButton theMonospaceButton ;
         public TableFonts()
    theStandardButton = new JRadioButton(standardFont);
         theStandardButton.setMnemonic(KeyEvent.VK_B);     
    theStandardButton.setSelected(true);
         theBoldButton = new JRadioButton(boldFont);
         theBoldButton.setMnemonic(KeyEvent.VK_B);     
    theItalicButton = new JRadioButton(italicFont);
         theItalicButton .setMnemonic(KeyEvent.VK_B);     
    theMonospaceButton = new JRadioButton(monospaceFont);
         theMonospaceButton.setMnemonic(KeyEvent.VK_B);     
         ButtonGroup group = new ButtonGroup();
    group.add(theStandardButton);
    group.add(theBoldButton);
    group.add(theItalicButton);
    group.add(theMonospaceButton);
    theStandardButton.addActionListener(this);
    theBoldButton.addActionListener(this);
    theItalicButton.addActionListener(this);
    theMonospaceButton.addActionListener(this);
    JLabel newLabel = new JLabel("Choose the correct font for the data to be displayed");
    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(newLabel);
    radioPanel.add(theStandardButton);
    radioPanel.add(theBoldButton);
    radioPanel.add(theItalicButton);
    radioPanel.add(theMonospaceButton);
    add(radioPanel, BorderLayout.LINE_START);
         public void actionPerformed(ActionEvent e) {
    The problem I am getting is the Number format exception when the OK button of the class Formats is clicked...
    here is the error I am getting:
    java.lang.NumberFormatException: For input string: "OK"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.
    java:48)
    at java.lang.Integer.parseInt(Integer.java:426)
    at java.lang.Integer.parseInt(Integer.java:476)
    at Formats.actionPerformed(Formats.java:80)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    64)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1817)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5134)
    at java.awt.Component.processEvent(Component.java:4931)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3639)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3480)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1590)
    at java.awt.Component.dispatchEvent(Component.java:3480)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    COULD YOU GUYS PLEASE TELL ME HOW TO GET AROUND THIS PROBLEM:
    THANKS...

    It's in this line:
    selectedOption = Integer.parseInt(e.getActionCommand().trim());
    Kind regards,
      Levi
    PS. have you noticed the [code][code[i]] tags?

  • Changing Font for JLabels

    Hello, I have created a small test program using a JComboBox. The purpose of this program is to change a JLabel to a certain font, based on the font that the user chooses from the JComboBox. My main concern is actually changing to font and I have no clue how to do this.
    The following is the code for this test program:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FontTest implements ActionListener{
         JFrame frame;
         JPanel contentPane;
         JComboBox font;
         JLabel fontPrompt, word;
         public FontTest(){
              frame = new JFrame("Font Styles");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              contentPane = new JPanel();
              contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
              contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
              fontPrompt = new JLabel("Select a font: ");
              fontPrompt.setAlignmentX(JLabel.LEFT_ALIGNMENT);
              contentPane.add(fontPrompt);
              String[] names = {"Times New Roman", "Ariel"}; //any font names that are available
              font = new JComboBox(names);
              font.setAlignmentX(JComboBox.LEFT_ALIGNMENT);
              font.setSelectedIndex(0);
              font.addActionListener(this);
              contentPane.add(font);
              word = new JLabel("font styles");
              word.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
              contentPane.add(word);
              frame.setContentPane(contentPane);
              frame.pack();
              frame.setVisible(true);
         public void actionPerformed(ActionEvent event){
              JComboBox comboBox = (JComboBox)event.getSource();
              String fontWord = (String)comboBox.getSelectedItem();
              if(fontWord == "Times New Roman"){//if any of these choices in the JComboBox are clicked,
                                                      //I would like the JLabel "font styles" to change font.                              
              else if(fontWord == "Ariel"){
         private static void runGUI(){
              JFrame.setDefaultLookAndFeelDecorated(true);
              FontTest display = new FontTest();
         public static void main(String[] args){
              javax.swing.SwingUtilities.invokeLater(new Runnable(){
                   public void run(){
                        runGUI();
    }It would be great if you guys could help me. Any font style is alright.
    Thanks in advance.

    Hi,
    Build a Font object and call setFont on the JLabel.
    Hope that help,
    Jack

  • How to make JFrame become the topmost window?

    I have server that is supposed to show a TOPMOST JFrame window each time it gets a "Show Window" command from client. I use JFrame to create and show the window in the server code:               
    JFrame mainWin = new JFrame();
    mainWin.setResizable( false );
    Container mainContainer = mainWin.getContentPane();
    mainContainer.setLayout( null );
    // add components to mainContainer
    mainWin.setVisible( true );
    mainWin.show();
    mainWin.toFront();
    If I run the server under windows platform, the first created JFrame window is always hiding behind under other application windows. However, the JFrame windows other than the 1st one are always at top.
    The BAD thing is, if I run the server under Macintosh platform, the JFrame windows are always hiding behind the other application windows.
    Does anyone know how to fix the problem? i.e., making the JFrame window appear on top of other windows under any platforms?
    Thanks.
    ZZ
    p.s. I am using JDK version is 1.3.0.

    there is some weirdness with java I've noticed under windows during development. When you start the app from a console window or script, if you change focus to another window before the first java window shows up, it will show up behind the window you changed focus to. If you leave it alone until the window shows, it will be on top. A work around is after you call show(), call toFront().

  • JFrame - changing listener generation style?

    Hi guys: Is there a way to change the 'listener generation style'? Say from 'Anonymous Inner Class' to 'Main Class'? Thanks

    public static void main ( String[] args )
    ButtonDemo2 frm = new ButtonDemo2();
    WindowQuitter wquit = new WindowQuitter();
    frm.addWindowListener( wquit );
    frm.setSize( 200, 150 );
    frm.setVisible( true );
    class WindowQuitter extends WindowAdapter
    public void windowClosing( WindowEvent e )
    System.exit( 0 ); // what to do for this
    event--exit the program
    }I noticed your little inner class called WindowQuitter. Did you know that JFrame has a nice method to make what you were doing REALLY easy? Here it is...
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);That's all there is to it. It does exactly what you were doing. There are some other good options for the parameter as well. Check it out sometime.

  • How to give styles to my HTMLDocument inside a JTextPane?

    I have a JTextPane with a HTMLDocument attached to it. How can I style the text which is typed in? For example I want to set a larger font. How can I do this in my example?
    Another problem is that when I hit the alignment buttons the text is actually aligned according to the hit button but the JEditorPane doesn't show the text correctly. It also doesn't enter a line feed when typing ENTER key.
    Can someone help me on this please?
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextPane;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    public class AdditionalText extends JFrame implements ActionListener {
         private JButton leftAlign;
         private JButton centerAlign;
         private JButton rightAlign;
         private JTextPane editor;
         private JButton save;
         private JButton dump;
         public AdditionalText() {
              setTitle("Test Frame");
              JPanel topToolbar = new JPanel();
              leftAlign = new JButton("Left");
              centerAlign = new JButton("Center");
              rightAlign = new JButton("Right");
              ActionListener alignLeft = new HTMLEditorKit.AlignmentAction("alignLeft", 0);
              ActionListener alignCenter = new HTMLEditorKit.AlignmentAction("alignCenter", 1);
              ActionListener alignRight = new HTMLEditorKit.AlignmentAction("alignRight", 2);
              leftAlign.addActionListener(alignLeft);
              centerAlign.addActionListener(alignCenter);
              rightAlign.addActionListener(alignRight);
              topToolbar.add(leftAlign);
              topToolbar.add(centerAlign);
              topToolbar.add(rightAlign);
              editor = createEditor();
              JPanel bottomToolbar = new JPanel();
              save = new JButton("Save");
              save.addActionListener(this);
              dump = new JButton("Dump");
              dump.addActionListener(this);
              bottomToolbar.add(save);
              bottomToolbar.add(dump);
              getContentPane().add(BorderLayout.NORTH, topToolbar);
              getContentPane().add(BorderLayout.CENTER, editor);
              getContentPane().add(BorderLayout.SOUTH, bottomToolbar);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              setSize(new Dimension(640, 480));
              setLocation((screenSize.width - 640) / 2, (screenSize.height - 480) / 2);
         private JTextPane createEditor() {
              JTextPane textPane = new JTextPane() {
                   public void paintComponent(Graphics g) {
                        Graphics2D g2 = (Graphics2D) g;
                        g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                        g2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
                        g2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
                        g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
                        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                        g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
                        g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
                        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                        super.paintComponent(g2);
              textPane.setEditorKit(new HTMLEditorKit());
              return textPane;
         public void actionPerformed(ActionEvent e) {
              HTMLDocument htmlDocument = (HTMLDocument) editor.getDocument();
              if(e.getSource() == save) {
                   HTMLEditorKit kit = (HTMLEditorKit)editor.getEditorKitForContentType("text/html");
                   try {
                        kit.write(System.out, htmlDocument, 0, htmlDocument.getLength());
                   } catch (IOException ex) {
                        ex.printStackTrace();
                   } catch (BadLocationException ex) {
                        ex.printStackTrace();
              } else if(e.getSource() == dump) {
                   htmlDocument.dump(System.err);
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
              } catch (InstantiationException e) {
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   e.printStackTrace();
              } catch (UnsupportedLookAndFeelException e) {
                   e.printStackTrace();
              AdditionalText at = new AdditionalText();
              at.show();
    }

    I created a class that can be used to highlight Java source code. Most of the code is for handling multi line comments. If you just want it to highlight certain keywords then you can get rid of all that logic. In case your interested, the code can be downloaded from here:
    http://www.discoverteenergy.com/files/SyntaxDocument.java

  • Problem with printing JFrame with several other components on it

    Hi,
    i am trying to print out a JFrame that contains other Swing and AWT components, such as JTables and menus etc.
    The problem is that the options that i select from the pageformat dialog, do not get set when the printing is taking place. As a result my jframe gets cut up into 4 differnet bits and each comes out on a seperate page. I cannot specify number of copies or size of paper either. Also once the ok button is pressed on the print dialogue, then the print dialogue comes back again and i have to press Ok, or Cancel to get rid of it. My code is below, please can someone suggest anything:
    ]public int print(Graphics g, PageFormat pf, int pi) throws PrinterException
    if (pi >= 1)
    return Printable.NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D) g;
    g2.translate(pf.getImageableX(), pf.getImageableY());
    g2.setColor(Color.black);
    paint(g2);
    return Printable.PAGE_EXISTS;
    PrinterJob pjob = PrinterJob.getPrinterJob();
    PageFormat pf = pjob.defaultPage();
    pjob.setPrintable(TransponderGraph.this, pf);
    try
    pjob.print();
    catch (PrinterException e) { }

    Ok, try this.
    Change this:
    <link href="
    http://www.jonbarron.org/css/style.css"
    rel="stylesheet" type="text/css" />
    to this:
    <link href="
    http://www.jonbarron.org/css/style.css"
    rel="stylesheet" type="text/css" media="screen" />
    Somewhere in that stylesheet lies your problem.

  • Problem with ToolTip Style

    I am trying to set a general style for tooltips and if I try
    and set the border style to solid (or anything besides none) the
    tool tip will only display the text, the background is gone and
    there is no border. Has anyone else run into this problem? I am
    setting the style through the main style sheet.
    ToolTip {
    background-color:#da0303;
    border-style:solid;
    border-thickness:2;
    border-color:#FFFFFF;
    corner-radius:8;
    }

    Try this code
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class UnderlineInSwing extends JFrame {
    public UnderlineInSwing() {
    super("Underline In Swing");
    setSize(400, 300);
    getContentPane().setLayout(new FlowLayout());
    JLabel lab = new JLabel();
              lab.setText("<html><u>Underlined text</u></html>");
    getContentPane().add(lab);
    WindowListener wndCloser = new WindowAdapter(){
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    addWindowListener(wndCloser);
    setVisible(true);
    public static void main(String args[]){
    new UnderlineInSwing();
    sunshine

  • Which is better? Extend JFrame or Wrap it in a class???

    Just a random thought, have been programming swing for a long time now and during the time have been researhed a lot of swing examples on web and found out that most people tend to make a class extend JFrame in order to use it stuff.
    However the way i've been programming is to wrap it around a class by creating an instance of JFrame inside my class. In that way i feel is more easier to program.
    But which is better style of programming and which is better programming technique in terms of robustness, reusablitity & good general programming practice?

    The usual answer, it depends. If you don't want to change a JFrame's behaviour, you wrap it. If the JFrame class is lacking a feature you need, you extend it and implement the desired feature.

  • Printing html text and font styles

    Hello,
    when I try to print html text in serif with italic or bold text style the output on a printer incorrectly shows the bold and italic parts in arial or something. Underlined text is printed correctly.
    The font is rendered correctly on a JEditorPane.
    There were some issues with html rendering in java (e.g. Bug IDs 4331766, 4160605, 1235430, 4141537) but as these bugs are closed/fixed in earlier jdk versions, and i found no hint that anyone else has experienced such problems, i may be doing something wrong?
    Regards,
    Dirk
    My Configuration: Windows 2000 (German), JDK 1.5.0_12
    For testing purposes i use the following:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.RepaintManager;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Document;
    import javax.swing.text.html.HTMLEditorKit;
    * QDH (Quick and Dirty Hack) Test
    public class PrintTestPane extends JEditorPane implements Printable {
       * shows printDialog and starts printing
      private void print() {
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable( this );
        if ( job.printDialog() ) {
          try {
            job.print();
          catch ( Exception ex ) {
            ex.printStackTrace();
        else {
          System.out.println( "Aborted" );
       * from Printable Interface: renders a page
      public int print( Graphics graphics, PageFormat pageFormat, int pageIndex )
          throws PrinterException {
        Graphics2D g2 = (Graphics2D) graphics;
        RepaintManager.currentManager( this ).setDoubleBufferingEnabled( false );
        Dimension d = getSize();
        double panelWidth = d.width;
        double panelHeight = d.height;
        double pageWidth = pageFormat.getImageableWidth();
        double pageHeight = pageFormat.getImageableHeight();
        double scale = pageWidth / panelWidth;
        int totalNumPages = (int) Math.ceil( scale * panelHeight / pageHeight );
        // Check for empty pages
        if ( pageIndex >= totalNumPages )
          return Printable.NO_SUCH_PAGE;
        g2.translate( pageFormat.getImageableX(), pageFormat.getImageableY() );
        g2.translate( 0f, -pageIndex * pageHeight );
        g2.scale( scale, scale );
        print( g2 );
        return Printable.PAGE_EXISTS;
       * @param args
      public static void main( String[] args ) {
        PrintTestPane testPane = new PrintTestPane();
        HTMLEditorKit kit = new HTMLEditorKit();
        Document doc = kit.createDefaultDocument();
        try {
          kit.read( new ByteArrayInputStream( htmltext.getBytes() ), doc, 0 );
        catch ( IOException e ) {
          throw new RuntimeException( e );
        catch ( BadLocationException e ) {
          throw new RuntimeException( e );
        testPane.setContentType( "text/html" );
        testPane.setDocument( doc );
        JFrame frame = new JFrame();
        frame.getContentPane().add( testPane, BorderLayout.CENTER );
        frame.addWindowListener( new WindowAdapter() {
          public void windowClosing( WindowEvent event ) {
            System.exit( 0 );
        frame.pack();
        frame.setVisible( true );
        testPane.print();
      private static String htmltext = " <html> <head>  </head>  <body> <font face=\"serif\"> plain <b>bold</b> plain <i>italic</i> plain <u>underlined</u> plain</font> </body> </html>";
      private static final long serialVersionUID = 1L;
    }

    Hello again,
    Update:
    With JRE 6 it seems to work (at least with update 2). Because Java 6 is currently not an option for me: should i file a Bug?
    Dirk

  • Container panels transparent in JInternalFrame with Windows XP Style

    Hi All
    I have a problem with a GUI where panels extending java.awt.Container (added to JInternalFrame) are transparent when using Windows XP Style (Windows XP Pro). The components added to the Container (for example JButton, JComboBox etc.) paint correctly but the surrounding space of the Container to which they belong is translucent such that the desktop below can be seen.
    When I switch to Windows Classic Style this does not happen. I'm using JDK6.0.
    Has anyone encountered this problem?
    Help appreciated
    Lance

    Just an update; this is the config I'm using to bootstrap the app (in main):
      UIManager.put("swing.boldMetal", Boolean.FALSE);
      UIManager.put("ToolTip.background", Color.YELLOW);
      JDialog.setDefaultLookAndFeelDecorated(true);
      JFrame.setDefaultLookAndFeelDecorated(true);
      Toolkit.getDefaultToolkit().setDynamicLayout(true);
      System.setProperty("sun.awt.noerasebackground","true");
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());The GUI is assembled from basic panels which extend Container, typical example below:
    public class BottomContainer extends Container implements ActionListener {
         private ActionListener handler;
         private ModeButton closeCancelButton;
         private JProgressBar progressBar;
         private ResourceBundle bundle;
         public BasicBottomContainer(ResourceBundle bundle) {
              super();
              this.bundle = bundle;
              createGui();
         public void actionPerformed(ActionEvent e) {
              Object source = e.getSource();
              ActionEvent xEvent = null; // translated event
              if (source == closeCancelButton) {
                   ButtonModes mode = ((ModeButton) source).getMode();
                   if (mode == ButtonModes.CANCEL) {
                        xEvent = new ProxyActionEvent(ActionProxies.CANCEL_BUTTON);
                   } else if (mode == ButtonModes.CLOSE) {
                        xEvent = new ProxyActionEvent(ActionProxies.CLOSE_BUTTON);
                   } else {
                        throw new IllegalArgumentException("Mode not defined");
              } else {
                   throw new IllegalArgumentException("Source not defined");
              handler.actionPerformed(xEvent);
         private void createGui() {
              setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
              progressBar = new JProgressBar();
              progressBar.setMinimum(0);
              progressBar.setMaximum(100);
              progressBar.setVisible(false);
              JPanel progressPanel = new JPanel();
              progressPanel.setLayout(new BorderLayout());
              progressPanel.add(progressBar, BorderLayout.CENTER);
              GuiUtils.setFixedSize(progressPanel, 200, 13);
              progressPanel.setVisible(false);
              ButtonModes mode = ButtonModes.CLOSE;
              closeCancelButton = new ModeButton(bundle.getString("closeButton"), mode);
              localeChangeList.add(closeCancelButton, "closeButton");
              closeCancelButton.setMinimumSize(new Dimension(80, 25));
              closeCancelButton.addActionListener(this);
              add(GuiUtils.rigidArea(15, 55)); // spacing with left-hand border & height
              add(progressPanel);
              add(Box.createHorizontalGlue()); // push apart
              add(closeCancelButton);
              add(GuiUtils.rigidArea(15, 0)); // spacing with right-hand border
              setVisible(false);
         public void updateRefreshProgress(int refreshProgress) {
              progressBar.setValue(refreshProgress);
         public void setCloseCancelButtonMode(ButtonModes mode) {
              closeCancelButton.setMode(mode);
         public void setHandler(ActionListener handler) {
              this.handler = handler;
    }The Container above is then attached in the main GUI something like this:
    public abstract class TestView extends AbstractView {
         protected TopContainer topContainer;
         protected MiddleContainer middleContainer;
         protected BottomContainer bottomContainer;
         public AbstractView() {
              createGui();
         private void createGui() {
              topContainer = new TopContainer(model.getBundle());
              middleContainer = new MiddleContainer();
              bottomContainer = new BottomContainer(model.getBundle());
              infoPanel.setVisible(false);
              container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
              container.add((Container) topContainer);
              container.add((Container) middleContainer);
              container.add(infoPanel.getContainer());
              container.add((Container) bottomContainer);
         protected void dispose() {
              super.dispose();
         public final void showGui(boolean visible) {
              super.showGui(visible);
              topContainer.setVisible(true);
              middleContainer.setVisible(true);
              bottomContainer.setVisible(true);
    }It appears that all the components (e.g. BottomContainer, TopContainer etc)
    which extend Container are transparent but I'm not able to replicate it with a simpler class (the panels are always opaque in simpler setup).
    Has anyone seen this before (as I mentioned above, this only happens when I set my config for Windows XP Pro to 'Windows XP Style' in the Control Panel).
    Help much appreciated
    Lance

  • How and put data frrom DB into JFrame.tables ?

    hello,
    I tried to get rows from a DB into a table. Therefore I created a class(A) with a function(a1) throws SQLException. Connect and select rows from the DB runs perfectly. Now I want to put this data into a table. I created another class(B) extends JFrame with an inner class(icB1) extends AbstractTableModel. From here I tried call A.a1 to get the rows but
    1. the return type should be StringArray, how should i declare a function returning type stringarray and
    2. I tried to put the data into a String, so that the return value is String(Iwould try sort the data after returning values) like
    " icB1 extends AbstractTableModel { A.a1(); }" then i get the error msg: "java.sql.SQLException; must caught or declared to be thrown". Then i tried with this: " try { statement } catch { statement }" but it also doesnt func .. So how put I data from a DB into a table ? the main idea is to show and manage DB tables from the web. Many Thanks
    regards erkan

    Hi Erkan
    Here's parts of a simple tutorial style app that shows how to easily get data from a DB into a table. Note that the code is incomplete and may have typos.
    public class SQLHandler {
      public List getData(String sql, List headers) {
        List result = new ArrayList();
        ResultSet rs = connection.executeQuery(sql);
        // Get column details
        ResultSetMetaData rsmd = rs.getMetaData();
        int columns = rsmd.getColumnCount();
        for (int i=0;i<columns;i++) {
          headers.add(rsmd.getColumnLabel(i+1));
        while(rs.next()) {
          Object array = new Object[columns];
          for(int i=0;i<columns;i++) {
            array[i] = rs.getObject(i+1); 
          list.add(array):
        return result;
    public class SQLDataTableModel implements AbstractTableModel {
      private List data;
      private List headers = new ArrayList();
      public SQLDataTableModel(String sql) {
         data = sqlHandler.getData(sql,headers);
      // abstract methods
      public int getRowCount() {
        return list.size();
      public int getColumnCount() {
        return headers.size();
      public Object getValueAt(int row, int column) {
        Object[] array = data.get(row);
        return array[column];
    // Create JTable and assign a model
    JTable table = new JTable();
    table.setModel( new SQLDataTableModel("select * from table")):cheers
    Dave

  • Custom Shape for JFrame

    HI,
    I need to give the custom shape for the JFrame. I used the setWindowShape method and i got the shape for the window. In my application, many custom shaped windows are occurring but all are same shapes. So i plan to keep the Custom Shaped window class as base class. If i need shaped window then i will create the class which extends the Custom Shaped window class through that i can get the custom shaped window, but i am not getting the custom shaped window.
    Here is the code for the custom shaped window. It is working fine.
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.geom.Ellipse2D;
    import javax.swing.*;
    public class ShapedWindow extends JFrame {
         public ShapedWindow() {
              super("ShapedWindow");
              try {
                   UIManager
                             .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
              } catch (InstantiationException e) {
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   e.printStackTrace();
              } catch (UnsupportedLookAndFeelException e) {
                   e.printStackTrace();
              JPanel jpnl = new JPanel() {
                   public void paintComponents(Graphics g) {
                        g.setColor(new Color(64, 144, 196));
                        g.setColor(Color.WHITE);
                        g.drawLine(270, 120, 395, 120);
              jpnl.setLayout(new FlowLayout(FlowLayout.RIGHT, -2, 2));
              jpnl.setBackground(new Color(1, 107, 177));
              this.setLayout(new BorderLayout());
              JButton jbtn1 = new JButton("Cancel");
              jbtn1.setBackground(new Color(1, 107, 177));
              jbtn1.setForeground(new Color(255, 255, 255));
              jbtn1.setFocusPainted(false);
              jbtn1.setBorderPainted(false);
              jbtn1.setContentAreaFilled(false);
              // jbtn1.setBounds(325, 90, 75, 25);
              jbtn1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt) {
                        JOptionPane.showMessageDialog(null, "Cancel");
              JButton jbtn2 = new JButton("OK");
              jbtn2.setBackground(new Color(1, 107, 177));
              jbtn2.setForeground(new Color(255, 255, 255));
              jbtn2.setFocusPainted(false);
              jbtn2.setBorderPainted(false);
              jbtn2.setContentAreaFilled(false);
              // jbtn2.setBounds(285, 90, 55, 25);
              jbtn2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt) {
                        JOptionPane.showMessageDialog(null, "OK");
              jpnl.add(jbtn2);
              jpnl.add(jbtn1);
              JPanel jpnl1 = new JPanel();
              jpnl1.setBackground(new Color(1, 107, 177));
              this.add(jpnl1, BorderLayout.CENTER);
              this.add(jpnl, BorderLayout.SOUTH);
              this.setResizable(false);
              this.setBackground(new Color(1, 107, 177));
              this.setSize(new Dimension(500, 150));
              this.setLocationRelativeTo(null);
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Polygon poly = new Polygon();
              poly.addPoint(1, 1);
              poly.addPoint(ShapedWindow.this.getWidth() - 1, 1);
              poly.addPoint(ShapedWindow.this.getWidth() - 1, ShapedWindow.this
                        .getHeight() - 1);
              poly.addPoint(ShapedWindow.this.getWidth() - 100, ShapedWindow.this
                        .getHeight() - 1);
              poly.addPoint(ShapedWindow.this.getWidth() - 130, ShapedWindow.this
                        .getHeight() - 30);
              poly.addPoint(1, getHeight() - 30);
              poly.addPoint(1, 1);
              com.sun.awt.AWTUtilities.setWindowShape(ShapedWindow.this, poly);
         public static void main(String[] args) {
              JFrame.setDefaultLookAndFeelDecorated(true);
              Window w = new ShapedWindow();
                 w.setVisible(true);
    }In the below code, i kept the base class jfrmShape class, for this i set the custom shape. childShape class which extends the jfrmShape. But i didn't get the shape. Please find the mistake and help me.
    package SWindow;
    import java.awt.Polygon;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    import PWGUI.ShapedWindow;
    public class jfrmShape extends JFrame {
         public jfrmShape() {
              Polygon poly = new Polygon();
              poly.addPoint(1, 1);
              poly.addPoint(jfrmShape.this.getWidth() - 1, 1);
              poly.addPoint(jfrmShape.this.getWidth() - 1,
                        jfrmShape.this.getHeight() - 1);
              poly.addPoint(jfrmShape.this.getWidth() - 100, jfrmShape.this
                        .getHeight() - 1);
              poly.addPoint(jfrmShape.this.getWidth() - 130, jfrmShape.this
                        .getHeight() - 30);
              poly.addPoint(1, getHeight() - 30);
              poly.addPoint(1, 1);
              com.sun.awt.AWTUtilities.setWindowShape(jfrmShape.this, poly);
              com.sun.awt.AWTUtilities.setWindowOpacity(jfrmShape.this, 0.56f);
                    setDefaultLookAndFeelDecorated(true);
              setTitle("Shaped Window");
              setSize(300, 300);
              setVisible(true);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    package SWindow;
    import javax.swing.JFrame;
    public class childShape extends jfrmShape{
         public static void main(String [] args)
              new childShape().setVisible(true);
    }

    In Keynote 6 there is no facility to save shape styles.

  • Dynamic resize of JButton and JFrame in response to Font

    Im supposed to increase the font size of the text with JButton by 1 within each click.
    Eventually the text becomes shorter and less visible like WORD becomes WOR... then WO... etc
    How to make the button always resize with text so that the text is fully visible and JFrame always resize with button so that the button doesn't change its position within the Frame ?
    edit:
    I managed to make buttons resize with increasing font
    by making
    JButton b = new JButton("button");
    b.setHorizontalTextPosition(CENTER);
    b.setVerticalTextPosition(CENTER);However the window size doesnt increase with components ;[
    any help would be appretiated.
    Edited by: pimpcane on Dec 11, 2007 12:16 PM

    Ok I managed to get it working moreless by
    adding pack() to the actionPerformed(...) function
    public void actionPerformed(ActionEvent e)
                 int index = Integer.parseInt(e.getActionCommand());
              int size = buttons[index].getFont().getSize();
              size++;
              buttons[index].setFont(new Font(name, style, size));
              pack();
    }The problem is in the task im given it is forbidden to use pack();
    Is there any other method to obtain the same result of JFrame resizing dynamically in response to components resize ?
    Edited by: pimpcane on Dec 12, 2007 12:13 PM
    Edited by: pimpcane on Dec 12, 2007 12:15 PM

Maybe you are looking for

  • I Try To Go To A Website For My FB Games And i Get A Error Message Saying 403 Forbidden I Dont Have Permission To Access The Server. It Use To Work

    You don't have permission to access /frontierville-cheats.php on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request This Is The Message I Receive When I Go To This Website

  • Can iMac be used as external monitor for old Mac Mini?

    I just bought a used Mac Mini PPC 1.4GHZ, 1GB Ram, 80GB HD. It will be shipped to my parents out of state but until then I need to configure it at home. Can I connect it to my iMac 20"? In other words, is there any way to turn off the direct connect

  • Soap RECEIVER adapter ssl config

    we are consuming a web service in sap ECC system via XI using SSL. So I configured receiver soap adapter. Imported the certificate provided by web service provider to J2EE visual admin key store. However I am not able to see my ceritificates popluate

  • Htpc crash every time it is left on idle.

    I have set up my htpc with a quite minimal arch install. It runs xbmc-standalone in an x-session, no DE or WM installed. EVery time it is left on idle, it crashes - aka total freeze. The ssh-session i have open does not die immediatly, but it stops r

  • 2 ipods...1 mac..??

    Hey guys, My mum just bought one of those shiny new nanos for her birthday and doesn't want to spend ages importing cd's into it on her computer, so I suggested letting her use my itunes...but then I wondered whether you could use 2 ipods on the same