biskuteri-cafe-JKomasto2/ComposeWindow.java
2021-07-17 06:03:59 -04:00

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));
}
}