|
Last change
on this file was
12513,
checked in by ehuelsmann, 16 years ago
|
|
Remove 'private' keyword to eliminate the Java requirement
for the compiler to generate synthetic accessors: functions that
don't appear in the source but do appear in the class file.
Patch by: Douglas Miles <dmiles _at_ users.sf.net>
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | package org.armedbear.lisp.java.awt; |
|---|
| 2 | |
|---|
| 3 | import java.awt.BorderLayout; |
|---|
| 4 | import java.awt.Dialog; |
|---|
| 5 | import java.awt.FlowLayout; |
|---|
| 6 | import java.awt.Frame; |
|---|
| 7 | import java.awt.Label; |
|---|
| 8 | import java.awt.Panel; |
|---|
| 9 | import java.awt.TextField; |
|---|
| 10 | import java.awt.event.ActionEvent; |
|---|
| 11 | import java.awt.event.ActionListener; |
|---|
| 12 | |
|---|
| 13 | import javax.swing.JButton; |
|---|
| 14 | |
|---|
| 15 | import org.armedbear.lisp.java.DialogPromptStream; |
|---|
| 16 | |
|---|
| 17 | public class AwtDialogPromptStream extends DialogPromptStream { |
|---|
| 18 | |
|---|
| 19 | Dialog dialog = new Dialog((Frame)null, true); |
|---|
| 20 | private Label prompt = new Label(); |
|---|
| 21 | private TextField input = new TextField(32); |
|---|
| 22 | |
|---|
| 23 | public AwtDialogPromptStream() { |
|---|
| 24 | this("Prompt"); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | public AwtDialogPromptStream(String title) { |
|---|
| 28 | super(); |
|---|
| 29 | dialog.setTitle(title); |
|---|
| 30 | Panel tmpPanel = new Panel(); |
|---|
| 31 | tmpPanel.add(prompt); |
|---|
| 32 | tmpPanel.add(input); |
|---|
| 33 | dialog.add(tmpPanel); |
|---|
| 34 | JButton okBtn = new JButton("Ok"); |
|---|
| 35 | okBtn.addActionListener(new ActionListener() { |
|---|
| 36 | |
|---|
| 37 | public void actionPerformed(ActionEvent e) { |
|---|
| 38 | synchronized(dialog) { |
|---|
| 39 | dialog.dispose(); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | }); |
|---|
| 43 | tmpPanel = new Panel(new FlowLayout()); |
|---|
| 44 | tmpPanel.add(okBtn); |
|---|
| 45 | dialog.add(tmpPanel, BorderLayout.SOUTH); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | @Override |
|---|
| 49 | protected void closeDialog() { |
|---|
| 50 | dialog.dispose(); |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | @Override |
|---|
| 54 | protected String readInputFromModalDialog(String promptText) { |
|---|
| 55 | prompt.setText(promptText); |
|---|
| 56 | dialog.pack(); |
|---|
| 57 | dialog.setVisible(true); |
|---|
| 58 | return input.getText(); |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.