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

  • Home
  • SEARCH
  • 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 8123999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:20:13+00:00 2026-06-06T06:20:13+00:00

I have a weird problem. I create this window, but its blank until i

  • 0

I have a weird problem. I create this window, but its blank until i minimize it and maximize it again. Is this a common Problem? Here is my code(Sry because of the long code….i have only deleted the action listeners, i was afraid i could delete the error).

public class Gui_preferences extends JFrame{
private static final long serialVersionUID = -2375617814937747645L;
private JTextField savingPathField;
private JTextField schoolField;
private JTextField classStageField;
private JFormattedTextField classdurationField;
private FunctionsSchedule fkSchedule;
JFormattedTextField schoolbeginningformattedTextField;
boolean firstopening;
JLabel notClosingLabel;
private JTextField formsFolderNameField;
private JTextField subjectsFolderNameField;

public Gui_preferences(boolean first, FunctionsSchedule fktSchedule) {
    this.fkSchedule = fktSchedule;
    setPreferredSize(new Dimension(650, 420));
    setSize(650, 420);
    setResizable(false);
    setAlwaysOnTop(true);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setVisible(true);

    JScrollPane scrollPane = new JScrollPane();
    getContentPane().add(scrollPane, BorderLayout.CENTER);

    JPanel panel = new JPanel();
    panel.setPreferredSize(new Dimension(500, 420));
    panel.setMinimumSize(new Dimension(500, 420));
    scrollPane.setViewportView(panel);
    panel.setLayout(new MigLayout("", "[][][grow][][][]", "[11.00][][12.00][][16.00][][17.00][][18.00][][16.00][24.00][15.00][24.00][15.00][][19.00][]"));

    JLabel savingPathLabel = new JLabel("New label");
    panel.add(savingPathLabel, "cell 0 1");

    savingPathField = new JTextField();
    savingPathField.setEditable(false);
    panel.add(savingPathField, "cell 2 1,growx");
    savingPathField.setColumns(10);

    JButton newSavingPath = new JButton("New button");
    panel.add(newSavingPath, "cell 4 1");

    JLabel school = new JLabel("New label");
    panel.add(school, "cell 0 3");

    schoolField = new JTextField();
    schoolField.addFocusListener(new FocusAdapter() {
    panel.add(schoolField, "cell 2 3,growx");
    schoolField.setColumns(10);

    JLabel classStage = new JLabel("New label");
    panel.add(classStage, "cell 0 5");
    classStageField = new JTextField();
    panel.add(classStageField, "cell 2 5,growx");
    classStageField.setColumns(10);

    JLabel classduration = new JLabel("New label");
    panel.add(classduration, "cell 0 9");

    classdurationField = new JFormattedTextField(createFormatter("###"));
    panel.add(classdurationField, "cell 2 9,growx");
    classdurationField.setColumns(10);

    JLabel schoolbeginning = new JLabel("New label");
    panel.add(schoolbeginning, "cell 0 7");

    schoolbeginningformattedTextField = new JFormattedTextField(createFormatter("##:##"));
    panel.add(schoolbeginningformattedTextField, "cell 2 7,growx");

    JLabel TrayIcon = new JLabel("New label");
    panel.add(TrayIcon, "cell 0 11");

    JCheckBox TrayIconCheckBox = new JCheckBox("New check box");
    panel.add(TrayIconCheckBox, "cell 2 11");

    JLabel otherFolderName = new JLabel("New label");
    panel.add(otherFolderName, "cell 0 13");

    formsFolderNameField = new JTextField();
    panel.add(formsFolderNameField, "cell 2 13,growx");
    formsFolderNameField.setColumns(10);

    JLabel subjectsFolderName = new JLabel("New label");
    panel.add(subjectsFolderName, "cell 0 15");

    subjectsFolderNameField = new JTextField();
    panel.add(subjectsFolderNameField, "cell 2 15,growx");
    subjectsFolderNameField.setColumns(10);

    notClosingLabel = new JLabel("New label");
    notClosingLabel.setFont(new Font("Tahoma", Font.PLAIN, 13));
    panel.add(notClosingLabel, "cell 2 17");

    //own code
    firstopening = first;
    //Labels & Co get the names
    savingPathLabel.setText(NonserData.exprs.getString("saving_Path")+": ");
    school.setText(NonserData.exprs.getString("school")+": ");
    classStage.setText(NonserData.exprs.getString("classStage")+": ");
    classduration.setText(NonserData.exprs.getString("classduration")+": ");
    TrayIcon.setText(NonserData.exprs.getString("TrayIcon")+": ");
    schoolbeginning.setText(NonserData.exprs.getString("schoolbeginning")+": ");
    TrayIconCheckBox.setText(NonserData.exprs.getString("enabled"));
    newSavingPath.setText(NonserData.exprs.getString("choose"));
    otherFolderName.setText(NonserData.GUI.getString("forms_folder_name")+": ");
    subjectsFolderName.setText(NonserData.GUI.getString("subject_Folder_name")+": ");

    //Checkbox activation/deactivation
    TrayIconCheckBox.setSelected(SerData.trayIconenabled);


    notClosingLabel.setEnabled(false);
    if(first)
    {
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        notClosingLabel.setEnabled(true);
        notClosingLabel.setText(NonserData.GUI.getString("not_cosing_before_filled"));
    }
    if(!first)
    {
        notClosingLabel.setVisible(false);
        notClosingLabel.setEnabled(false);
    }
    fillTextBoxes();
    repaint();
}
  • 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-06T06:20:14+00:00Added an answer on June 6, 2026 at 6:20 am

    You should call setVisible(true); once all your components are added to the form not before.
    Also, remove the superfluous repaint() call at the end.

    EDIT Added comment from Andrew.
    Note that pack() or validate() should be called before setVisible(true) for a reliably laid out GUI. Thanks @Andrew Thompson

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

Sidebar

Related Questions

This is kind of a weird problem, but I have to create a search
I have this weird problem with setting up cookies with PHP. Everything worked fine
I have a weird problem, and I don't know if this is the default
I have run into this problem a lot in the past, but never really
I know how to use RVM, but now I have a weird problem, which
I have this really weird problem in my code (.Net Framework 3.5). So, in
I have a very weird problem. This ONLY affects Firefox on Mac, using the
I've a weird problem with malloc. I have this typedefs: typedef struct buffer {
I facing a weird problem here. I already have a simple try-out for jquery
I have a weird problem where after setting nocheck on a foreign constraint and

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.