mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 04:54:50 +01:00
93 lines
1.7 KiB
Java
93 lines
1.7 KiB
Java
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JComponent;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.Box;
|
|
import java.awt.BorderLayout;
|
|
import java.awt.Font;
|
|
|
|
class
|
|
TimelineWindow extends JFrame {
|
|
|
|
private TimelineComponent
|
|
display;
|
|
|
|
// ---%-@-%---
|
|
|
|
// ---%-@-%---
|
|
|
|
TimelineWindow()
|
|
{
|
|
setContentPane(display);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class
|
|
TimelineComponent extends JPanel {
|
|
|
|
TimelineComponent()
|
|
{
|
|
setLayout(new BorderLayout());
|
|
add(new PreviewComponent());
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class
|
|
PreviewComponent extends JComponent {
|
|
|
|
private JLabel
|
|
topLeft, topRight, bottom;
|
|
|
|
// ---%-@-%---
|
|
|
|
public void
|
|
setTopLeft(String text) { topLeft.setText(text); }
|
|
|
|
public void
|
|
setTopRight(String text) { topRight.setText(text); }
|
|
|
|
public void
|
|
setBottom(String text) { bottom.setText(text); }
|
|
|
|
// ---%-@-%---
|
|
|
|
public
|
|
PreviewComponent()
|
|
{
|
|
Font font;
|
|
|
|
topLeft = new JLabel("Top left");
|
|
font = topLeft.getFont();
|
|
topLeft.setFont(font.deriveFont(Font.PLAIN, 12f));
|
|
setOpaque(false);
|
|
|
|
topRight = new JLabel("Top right");
|
|
topRight.setHorizontalAlignment(JLabel.RIGHT);
|
|
font = topRight.getFont();
|
|
topRight.setFont(font.deriveFont(Font.ITALIC, 12f));
|
|
setOpaque(false);
|
|
|
|
bottom = new JLabel("Bottom");
|
|
font = bottom.getFont();
|
|
bottom.setFont(font.deriveFont(Font.PLAIN, 16f));
|
|
bottom.setOpaque(false);
|
|
|
|
Box top = Box.createHorizontalBox();
|
|
top.add(topLeft);
|
|
top.add(Box.createGlue());
|
|
top.add(topRight);
|
|
|
|
setLayout(new BorderLayout());
|
|
add(top, BorderLayout.NORTH);
|
|
add(bottom, BorderLayout.SOUTH);
|
|
}
|
|
|
|
}
|