Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Jframe doesn't work on Mac OS X
Jframe doesn't work on Mac OS X [message #652773] Sun, 06 February 2011 16:06
No real name is currently offline No real nameFriend
Messages: 4
Registered: February 2011
Junior Member
Hello,
I created this Application with WindowBuilderPro using JFrame:
package te;

import java.awt.Cursor;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.UIManager;


public class te{

	private JFrame frmXdxxxrt;
	private JTextField textField;
	private final JButton button = new JButton("schliessen");

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					te window = new te();
					window.frmXdxxxrt.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public te() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmXdxxxrt = new JFrame();
		frmXdxxxrt.setVisible(true);
		frmXdxxxrt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		frmXdxxxrt.setTitle("xdxxxrt");
		frmXdxxxrt.setForeground(UIManager.getColor("Button.light"));
		frmXdxxxrt.setBackground(UIManager.getColor("Button.highlight"));
		frmXdxxxrt.setAlwaysOnTop(true);
		frmXdxxxrt.setBounds(100, 100, 450, 300);
		frmXdxxxrt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frmXdxxxrt.getContentPane().setLayout(null);
		
		textField = new JTextField();
		textField.setBounds(90, 96, 285, 28);
		frmXdxxxrt.getContentPane().add(textField);
		textField.setColumns(10);
		button.setSelected(true);
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				System.out.println("this message doesn't appear on OS X");
				System.exit(0);
			}
		});
		button.setBounds(151, 163, 119, 29);
		frmXdxxxrt.getContentPane().add(button);
	}
}

When i build and run it the Button doesn't react. When I copy the code to my Windows-Installation it works perfectly.
I didn't change anything in the Settings.
I'm using the latest Eclipse Helios build.
Can anyone help me?
Previous Topic:Still Having problems starting eclipse
Next Topic:No console output with CDT
Goto Forum:
  


Current Time: Mon Sep 23 08:44:21 GMT 2024

Powered by FUDForum. Page generated in 0.06312 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top