Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:08:10+00:00 2026-06-10T22:08:10+00:00

So I have 3 JFrames. JFrame 1 (aka opts) is for inputting some variables.

  • 0

So I have 3 JFrames. JFrame 1 (aka opts) is for inputting some variables. On OK, it creates JFrame 2 (aka view, a graphical viewing Frame). In the constructor, JFrame 3 (aka manager, for cycling through the graphical views) is created instantly.
I want them to be Windows-alike decorated with JFrame.setDefaultLookAndFeelDecorated(true) (from now on referred to as “it”).

A few differtent cases:

  1. When I don’t set it at all, all JFrames are Windows decorated.
  2. When I put it in the “opts” or “manager” constructor, run the project, and click the OK button, all JFrames are Windows-alike decorated.
  3. However, when I put it in the “view” constructor, only “opts” and “view” are Windows decorated, but “manager” is Java decorated.
  4. But when I put it in a class which does nothing more than read some data from a file, and make some objects out of it, only “opts” is Windows decorated.

How exactly does it work? I want to know why it happens as it happens.

Edit: I can’t reproduct case 4, but still, some things happen that I don’t understand. Try commenting out some of the “it”s. It’ll give some strange results.

package test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class Frame1 extends JFrame {
  public Frame1() {
    JFrame.setDefaultLookAndFeelDecorated(true);
      Frame1.setOptions(this);
      JButton b1 = new JButton("hi");
      b1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          makeFrame2(2);
        }
      });
      this.add(b1);
    }

    public void makeFrame2(int x) {
      this.dispose();
      new Frame2(x);
    }

    public static void setOptions(JFrame f) {
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setSize(250, 250);
      f.setEnabled(true);
      f.setVisible(true);
    }

    public static void main(String[] args) {
      new Frame1();
    }
}

package test;

import javax.swing.JFrame;

public class Frame3 extends JFrame {
  Frame2 link;
  SomeClass sc;

  public Frame3(Frame2 link)  {
    JFrame.setDefaultLookAndFeelDecorated(true);
    Frame1.setOptions(this);
    this.link = link;
    sc = new SomeClass(25);
  }
}

package test;

import javax.swing.JFrame;

public class SomeClass {
  int x;

  public SomeClass(int x) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    this.x = x;
  }
}

package test;

import javax.swing.JFrame;

public class Frame2 extends JFrame {
  public Frame2(int x) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    Frame1.setOptions(this);
    new Frame3(this);
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:08:12+00:00Added an answer on June 10, 2026 at 10:08 pm

    According to the oracle java documentation, setDefaultLookAndFeelDecorated changes the parameter for all newly created JFrames, all existing JFrames are unchanged.

    JFrame Documentation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JFrame with some a JTextField and a JButton. I want it
Just need some quick guidance - I have a main frame, and I want
I have a JFrame , which have some options. When OK button is pressed
I have a JFrame with BorderLayout as the layout manager. In the south border,
If I have two JFrames where one is the main JFrame, and the other
I have two Jframes where frame1 has some text fields and when a button
I have a JFrame and In which I want to show a JInternal Frame
let's say that i have 2 JFrames (A) & (B) Frame (A) fires Frame
I have a JFrame with 1 panel for drawing and set KyeListener for JFrame.
I have a JFrame which on instantiation calls a custom JDialog(Login). If login is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.