2021-07-16 01:07:23 +02:00
|
|
|
|
|
|
|
import javax.swing.JFrame;
|
|
|
|
import javax.swing.JPanel;
|
2021-07-17 11:06:50 +02:00
|
|
|
import javax.swing.JTextArea;
|
|
|
|
import javax.swing.JButton;
|
|
|
|
import javax.swing.Box;
|
|
|
|
import javax.swing.BorderFactory;
|
|
|
|
import java.awt.BorderLayout;
|
|
|
|
import java.awt.Dimension;
|
2021-07-16 01:07:23 +02:00
|
|
|
|
|
|
|
class
|
|
|
|
ComposeWindow extends JFrame {
|
|
|
|
|
2021-07-17 11:46:27 +02:00
|
|
|
private Composition
|
|
|
|
composition;
|
|
|
|
|
|
|
|
// - -%- -
|
|
|
|
|
2021-07-16 01:07:23 +02:00
|
|
|
private ComposeComponent
|
|
|
|
display;
|
|
|
|
|
2021-07-17 13:17:14 +02:00
|
|
|
// - -%- -
|
|
|
|
|
|
|
|
private static final Composition
|
|
|
|
NULL_COMPOSITION = new Composition();
|
|
|
|
{
|
|
|
|
NULL_COMPOSITION.text = "This is a sample composition..!";
|
|
|
|
NULL_COMPOSITION.visibility = PostVisibility.PUBLIC;
|
|
|
|
NULL_COMPOSITION.replyToPostId = null;
|
|
|
|
}
|
|
|
|
|
2021-07-17 11:46:27 +02:00
|
|
|
// ---%-@-%---
|
|
|
|
|
|
|
|
public void
|
|
|
|
setComposition(Composition composition)
|
|
|
|
{
|
|
|
|
assert composition != null;
|
|
|
|
this.composition = composition;
|
|
|
|
}
|
|
|
|
|
2021-07-16 01:07:23 +02:00
|
|
|
// ---%-@-%---
|
|
|
|
|
|
|
|
ComposeWindow()
|
|
|
|
{
|
2021-07-16 11:46:17 +02:00
|
|
|
getContentPane().setPreferredSize(new Dimension(360, 270));
|
|
|
|
pack();
|
|
|
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
|
|
|
|
2021-07-16 01:07:23 +02:00
|
|
|
display = new ComposeComponent();
|
2021-07-17 12:03:59 +02:00
|
|
|
|
2021-07-16 01:07:23 +02:00
|
|
|
setContentPane(display);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class
|
2021-07-17 11:06:50 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|