Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Re-sizing JButtons

843807Jun 9 2010 — edited Jun 9 2010
Having some problems with my JDialog Box. I like the size of the JDialog Box and the JTextArea, but I don't want the JButton's so big. Is there any way to re-size them. I have tried the setPreferredSize method, but it doesn't do anything. I am using GridBoxLayout.
public class CustomDialog extends JDialog implements ActionListener {
       
        private JPanel panel1 = null;
        private JPanel panel2 = null;
        private JPanel mainPanel = null;
        private JTextArea txtDatabaseSettings = null;
        private JButton cmdSave = null;
        private JButton cmdCancel = null;
    
        private boolean answer = false;
        
        public boolean getAnswer() { return answer; }

    public CustomDialog(JFrame frame, boolean modal, String myMessage) {
        super(frame, modal);

        txtDatabaseSettings = new JTextArea();
                
        cmdSave = new JButton("Save");
        cmdSave.setHorizontalAlignment(SwingConstants.CENTER);
        cmdSave.addActionListener(this);
        
        cmdCancel = new JButton("Cancel");
        cmdCancel.setHorizontalAlignment(SwingConstants.CENTER);
        cmdCancel.addActionListener(this);
          
        panel1 = new JPanel();
        panel1.setLayout(new GridLayout(1, 1));
        panel1.add(new JScrollPane(txtDatabaseSettings));
        
        panel2 = new JPanel();
        panel2.setLayout(new GridLayout(1, 2));
        panel2.add(cmdSave);
        panel2.add(cmdCancel);
        
        mainPanel = new JPanel();
        mainPanel.setLayout(new GridLayout(2, 1));
        mainPanel.setPreferredSize(new Dimension(350, 150));
        getContentPane().add(mainPanel);
        
        mainPanel.add(panel1);
        mainPanel.add(panel2);
     
        setTitle(myMessage);
        pack();
        setLocationRelativeTo(frame);
        setVisible(true);
    }
Any help would be appreciated.

Thanks!

Comments

Danish Anwar

I also got same error..

NickR2600-Oracle

Let me check.  It could be that a link isn't formatted properly.  Which page were you on when you clicked to download the game?

3357160

I was on Welcome page.

I also get same error when I am on Lesson 1 page, and click on links "Java puzzle ball (Basic Puzzles 1-5), Lab 1 instructions, Lab 1 start state.

Video links work thought on Lesson 1 page.

NickR2600-Oracle
Answer

I think I've found a fix.  Are the links working for you now?

Marked as Answer by 3357160 · Sep 27 2020
3357160

Yes, links are working now, thank you.

navi2687

How did you fix this?

navi2687

nevermind, I fixed it. It was due to something wrong with my DNS server and was an easy fix. Just changed the IPV4 DNS server as 8.8.8.8 for preferred and 8.8.4.4 for alternate... and Voila.. it worked

Ref - https://www.mobipicker.com/dns_probe_finished_nxdomain/

User_XVWTK

hello

don't work anymore today may 22-th:

DNS error

DNS error (the host name of the page you are looking for does not exist)

Please check that the host name has been spelled correctly.

with another internet connexion and another brother:

same error as title of post:

DNS_PROBE_FINISHED_NXDOMAIN error

for www-content.oracle.com

NickR2600-Oracle

That's odd... I'm not able to reproduce this.  Is the issue still occurring?

Ganga Madhavan

how to solve the issue

1 - 10
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 7 2010
Added on Jun 9 2010
1 comment
461 views