mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 07:44:51 +01:00
Set prospective sizes for windows
This commit is contained in:
parent
5defb14735
commit
7defacfb34
@ -1,19 +0,0 @@
|
||||
|
||||
(1) The Tab Manager
|
||||
|
||||
The GUI is centralised around an always-present Tab Manager. It keeps track of what timelines, what posts, and what reply sessions, are open.
|
||||
|
||||
There is a singular timeline window, post window, and reply window. They are highly integrated with the tab manager, displaying what it says is selected.
|
||||
|
||||
The windows get their domain object from the tab manager, and handle rendering it into their content pane.
|
||||
|
||||
Everyone has a mix of forwarding actions, and abstract actions.
|
||||
|
||||
|
||||
(2) The Windows
|
||||
|
||||
This classical design is centralised on no one. It has the application close when all windows are closed. Regular windows are spawned by actions, and special windows can be opened by menu.
|
||||
|
||||
The hidden application instance provides window management services and access to the data interchange. But all windows store and manage their domain objects by themselves.
|
||||
|
||||
Windows will probably be local controllers, while their content panes are controlled components.
|
@ -8,12 +8,14 @@ ComposeWindow extends JFrame {
|
||||
private ComposeComponent
|
||||
display;
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
ComposeWindow()
|
||||
{
|
||||
getContentPane().setPreferredSize(new Dimension(360, 270));
|
||||
pack();
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
|
||||
display = new ComposeComponent();
|
||||
setContentPane(display);
|
||||
}
|
||||
@ -23,6 +25,4 @@ ComposeWindow extends JFrame {
|
||||
|
||||
|
||||
class
|
||||
ComposeComponent extends JPanel {
|
||||
|
||||
}
|
||||
ComposeComponent extends JPanel { }
|
||||
|
@ -8,34 +8,14 @@ import java.awt.BorderLayout;
|
||||
class
|
||||
JKomasto {
|
||||
|
||||
public void
|
||||
openTimelineWindow() {
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
openPostWindow() {
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
openComposeWindow() {
|
||||
|
||||
}
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
public static void
|
||||
main(String... args)
|
||||
{
|
||||
JKomasto instance = new JKomasto();
|
||||
}
|
||||
main(String... args) { new JKomasto(); }
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
JKomasto()
|
||||
{
|
||||
|
||||
new PostWindow().setVisible(true);
|
||||
}
|
||||
|
||||
// - -%- -
|
||||
@ -57,3 +37,24 @@ JKomasto {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class
|
||||
Timeline {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class
|
||||
Post {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class
|
||||
Composition {
|
||||
|
||||
}
|
||||
|
@ -17,34 +17,57 @@ import java.util.ArrayList;
|
||||
class
|
||||
PostWindow extends JFrame {
|
||||
|
||||
private Post
|
||||
post;
|
||||
|
||||
// - -%- -
|
||||
|
||||
private PostComponent
|
||||
posts;
|
||||
postDisplay;
|
||||
|
||||
private RepliesComponent
|
||||
replies;
|
||||
|
||||
// ---%-@-%---
|
||||
repliesDisplay;
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
PostWindow()
|
||||
{
|
||||
getContentPane().setPreferredSize(new Dimension(360, 270));
|
||||
pack();
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
setLocationByPlatform(true);
|
||||
|
||||
posts = new PostComponent();
|
||||
postDisplay = new PostComponent();
|
||||
postDisplay.setAuthor("杉原宇砂鷲");
|
||||
postDisplay.setTime("いつ");
|
||||
//postDisplay.setText("これはふさわしいですね。");
|
||||
postDisplay.setText(
|
||||
"While it is true that a formal science process is "
|
||||
+ "not involved (recall that not just scientists, "
|
||||
+ "but also psychologists, etc. follow it), "
|
||||
+ "individuals' solutions can be trusted to be "
|
||||
+ "the most focused on their unique needs. "
|
||||
+ "If successful, the individual's solution can "
|
||||
+ "be a formidable alternative to employing "
|
||||
+ "assistance by professionals. Purportedly."
|
||||
);
|
||||
// (Don't take that seriously, I just wrote down
|
||||
// random topical text)
|
||||
|
||||
replies = new RepliesComponent();
|
||||
repliesDisplay = new RepliesComponent();
|
||||
|
||||
JMenu postMenu = new JMenu("Post");
|
||||
postMenu.add("Favourite");
|
||||
postMenu.add("Reply");
|
||||
postMenu.add("Show replies");
|
||||
JMenu displayMenu = new JMenu("Display");
|
||||
displayMenu.add("Post");
|
||||
displayMenu.add("Replies");
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
menuBar.add(postMenu);
|
||||
menuBar.add(displayMenu);
|
||||
setJMenuBar(menuBar);
|
||||
|
||||
setContentPane(posts);
|
||||
setSize(360, 270);
|
||||
setContentPane(postDisplay);
|
||||
}
|
||||
|
||||
}
|
||||
@ -85,20 +108,39 @@ PostComponent extends JPanel {
|
||||
protected void
|
||||
paintComponent(Graphics g)
|
||||
{
|
||||
int lineHeight = 24;
|
||||
|
||||
int lineHeight = 20;
|
||||
g.drawString(author, 0, lineHeight);
|
||||
|
||||
g.drawString(text, 0, 2 * lineHeight);
|
||||
int y = lineHeight;
|
||||
for (String line: split(text, 48)) {
|
||||
y += lineHeight;
|
||||
g.drawString(line, 0, y);
|
||||
}
|
||||
}
|
||||
|
||||
private List<String>
|
||||
split(String string, int lineLength)
|
||||
{
|
||||
List<String> returnee = new ArrayList<>();
|
||||
|
||||
int start, max = string.length();
|
||||
for (start = 0; start < max; start += lineLength) {
|
||||
returnee.add(string.substring(
|
||||
start,
|
||||
Math.min(max, start + lineLength)
|
||||
));
|
||||
}
|
||||
|
||||
return returnee;
|
||||
}
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
PostComponent()
|
||||
{
|
||||
author = "Author";
|
||||
time = "Time";
|
||||
text = "This is a soft post..";
|
||||
author = time = text = "";
|
||||
|
||||
setFont(getFont().deriveFont(14f));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,19 +6,28 @@ import javax.swing.JLabel;
|
||||
import javax.swing.Box;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Dimension;
|
||||
|
||||
class
|
||||
TimelineWindow extends JFrame {
|
||||
|
||||
private Timeline
|
||||
timeline;
|
||||
|
||||
// - -%- -
|
||||
|
||||
private TimelineComponent
|
||||
display;
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
TimelineWindow()
|
||||
{
|
||||
getContentPane().setPreferredSize(new Dimension(300, 400));
|
||||
pack();
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
|
||||
display = new TimelineComponent();
|
||||
setContentPane(display);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user