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 6013479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:33:18+00:00 2026-05-23T02:33:18+00:00

For some reason every time I have someone run this program in Vista it

  • 0

For some reason every time I have someone run this program in Vista it works flawlessly but as soon as I move it over to a Windows 7 PC it stops in the middle of the ActionListener’s Action Performed Method meaning I can click my choices but it will never say size selected.
Is there any way to fix this?

import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class SizerFrame extends JFrame {
    ButtonGroup buttons = new ButtonGroup();
    JTextField width = new JTextField(2);
    JTextField height = new JTextField(2);
    double inchesPerTimeline = 2.1;
    public SizerFrame()
    {
        super("Timeline Application");
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(screen.width/2-125,screen.height/2-90,250,180);
        getContentPane().setLayout(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        int[] gridX = new int[]{0,0,0,0};
        int[] gridY = new int[]{0,1,2,3};
        int[] gridW = new int[]{1,1,2,5};
        String[] titles = new String[]{"6\"","9\"","10\"","Custom"};
        String[] actions = new String[]{"6","9","10","C"};
        for (int a = 0; a < 4; a++)
        {
            JRadioButton current = new JRadioButton(titles[a]);
            current.setActionCommand(actions[a]);
            c.gridx = gridX[a];
            c.gridy = gridY[a];
            c.gridwidth = gridW[a];
            buttons.add(current);
            getContentPane().add(current,c);
        }
        c.gridwidth = 1;
        String[] title = new String[]{"      ","Width","Height"};
        gridX = new int[]{9,10,12};
        for (int a = 0; a< 3; a++)
        {
            c.gridx = gridX[a];
            getContentPane().add(new JLabel(title[a]),c);
        }
        c.gridx = 11;
        getContentPane().add(width,c);
        c.gridx = 13;
        getContentPane().add(height,c);
        c.gridx = 11;
        c.gridy = 0;
        c.gridwidth = 2;
        JButton button = new JButton("Done");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ButtonModel x = buttons.getSelection();
                String size = "XXX";
                System.out.println("Getting screen resolution");
                int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();
                System.out.println("Successfully got screen resolution");
                if (x!=null)
                    size = x.getActionCommand();
                try{
                    TimeTable.width = new Integer(size)*screenRes;
                    TimeTable.height = (int)((TimeTable.titleCount+1)*inchesPerTimeline*screenRes);
                }
                catch(NumberFormatException ex)
                {
                    try{
                        TimeTable.width = (int)(new Double(width.getText().trim())*screenRes);
                        TimeTable.height = (int)(new Double(height.getText().trim())*screenRes);
                    }
                    catch (NumberFormatException except)
                    {
                        return;
                    }
                }
                TimeTable.ready = true;
                System.out.println("Size selected");
                dispose();
            }
        });
        getContentPane().add(button,c);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent winEvt){
                System.exit(0);
            }
        });
        setVisible(true);
    }
}

Concise explanation :
I have a macro that runs out of Excel in Windows Vista and I tried to distribute it to a Computer running Windows 7. Upon execution the code failed to continue executing after this point i.e. it never printed out the words “Size selected”. The rest of the program brings in a csv file from a C:\Users\?\AppData\TimeLineMacroProgram folder and later creates an image in the same directory. But this is the portion of the code that is currently broken. Whenever the GUI pops up I select the option for 9″ and click done which should pass in 9 as a parameter and then print out “Size Selected” but it doesn’t it only disposes the window. Please help.

  • 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-05-23T02:33:19+00:00Added an answer on May 23, 2026 at 2:33 am

    Longshot guess:

    There is an exit from your action listener if width and height text fields don’t have content: you return after two NumberFormatExceptions. This would prevent “Size selected” from being displayed, and not dispose the frame. If you got the output “Successfully got screen resolution” and then it appeared to stop working, this could possibly be why. But if you experience that, and then click something else and then Done, it would print size selected.

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

Sidebar

Related Questions

For some reason, every time I run my Iphone App, the App works fine
For some reason, Section 1 works but Section 2 does not. When run in
For some reason every time I try to count the number of rows in
well for some strange reason IE gives me and InvalidAuthenticityToken error almost every time
I'm not quite sure how I got into this mess, but for some reason
For some reason lately, every time I pull and get a merge conflict, running
for some reason I do that every time because I find it clean. I
Guys, for some reason EL is not telling actions from properties. I have this
k this is probably something very easy but for some reason i am getting
This should be basic, but for some reason its not working for me. I

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.