Hi.

Do the following in your class:

public final class Thesis extends WeakBase
   implements com.sun.star.lang.XServiceInfo,
              com.sun.star.frame.XDispatchProvider,
              com.sun.star.lang.XInitialization,
              com.sun.star.frame.XDispatch,
              java.awt.event.ActionListener


and later on implement this:

    public void GUI() {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame("Test Frame");

// Do not do this! This will force the JavaVM to quit,
// and thus breaks the Office.
// see javadoc for javax.swing.JFrame:
// you are NOT an application, only an extension ;-)
//        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JButton clickButton = new JButton("Click Me");
        clickButton.setActionCommand("clickme");
        clickButton.addActionListener(this);
        frame.add(clickButton);

        frame.pack();
        frame.setVisible(true);
    }

    public void actionPerformed(ActionEvent actionEvent) {
        if ("clickme".equals(actionEvent.getActionCommand())) {
            JOptionPane.showMessageDialog(new Frame(),
                "Button 'Click me' clicked.");
        }
    }

I took this nearly 1:1 from
http://java.sun.com/docs/books/tutorial/uiswing/components/button.html
which is a great source for code examples in Java.

Your question seems to have no relevance to OpenOffice.org, so this may be the wrong mailing list. I'd suggest some Java specific list for questions like these.

HTH, Steffen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to