mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 06:34:49 +01:00
77 lines
1.3 KiB
Java
77 lines
1.3 KiB
Java
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.JButton;
|
|
import javax.swing.Box;
|
|
import javax.swing.BorderFactory;
|
|
import java.awt.BorderLayout;
|
|
import java.awt.Dimension;
|
|
|
|
class
|
|
ComposeWindow extends JFrame {
|
|
|
|
private Composition
|
|
composition;
|
|
|
|
// - -%- -
|
|
|
|
private ComposeComponent
|
|
display;
|
|
|
|
// ---%-@-%---
|
|
|
|
public void
|
|
setComposition(Composition composition)
|
|
{
|
|
assert composition != null;
|
|
this.composition = composition;
|
|
}
|
|
|
|
// ---%-@-%---
|
|
|
|
ComposeWindow()
|
|
{
|
|
getContentPane().setPreferredSize(new Dimension(360, 270));
|
|
pack();
|
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
|
|
|
display = new ComposeComponent();
|
|
|
|
setContentPane(display);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class
|
|
ComposeComponent extends JPanel {
|
|
|
|
private JTextArea
|
|
text;
|
|
|
|
private JButton
|
|
submit;
|
|
|
|
// ---%-@-%---
|
|
|
|
ComposeComponent()
|
|
{
|
|
text = new JTextArea();
|
|
|
|
submit = new JButton("Submit");
|
|
|
|
Box bottom = Box.createHorizontalBox();
|
|
bottom.add(Box.createGlue());
|
|
bottom.add(submit);
|
|
|
|
setLayout(new BorderLayout(0, 8));
|
|
add(text, BorderLayout.CENTER);
|
|
add(bottom, BorderLayout.SOUTH);
|
|
|
|
setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
|
}
|
|
|
|
}
|