G
Guest
Gast
Code:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class JasminTest
{
public static void main(String[] args)
{
NewFrame frame = new NewFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
JOptionPane.showMessageDialog(null, "Haha");
}
}
class NewFrame extends JFrame
{
public NewFrame()
{
setTitle("JasminTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
JLabel label = new JLabel("<html><table border='0' cellpadding='0' cellspacing='0' width='300' height='200'><tr><td width='100%' height='169' valign='middle' align='center' bgcolor='#000000'><font face='Goudy Stout' size='9' color='#910DDF'>[b]Text[/b]</font>
[url='http://www.habbocoding.de/']Powred by Habbocoding.de[/url]</td></tr></table></html>");
add(label);
buttonPanel panel = new buttonPanel();
add(panel);
}
public static final int DEFAULT_WIDTH = 300;
public static final int DEFAULT_HEIGHT = 200;
}
class buttonPanel extends JPanel
{
public buttonPanel()
{
JButton homeButton = new JButton("Home");
add(homeButton);
homeAction action = new homeAction();
homeButton.addActionListener(homeAction);
}
private class homeAction implements ActionListener
{
public homeAction()
{
Desktop.getDesktop().open("www.java-forum.org");
}
public void actionPerformed(ActionEvent event)
{
Desktop.getDesktop().open("www.java-forum.org");
}
}
}
Das ist der Code, nun wollte ich, dass wenn man auf den Button klickt, meine Seite geöffnet wird, doch:
1. - Das Panel ist auf einmal weg
2. - 3 Fehler: