import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JComponent; import java.awt.Dimension; import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.Image; import java.util.List; import java.time.ZonedDateTime; class JKomasto { private TimelineWindow timelineWindow; private ComposeWindow composeWindow; private PostWindow autoViewWindow; private LoginWindow loginWindow; private ImageWindow mediaWindow; private MastodonApi api; // ---%-@-%--- public MastodonApi getMastodonApi() { return api; } public void finishedLogin() { autoViewWindow.setCursor(new Cursor(Cursor.WAIT_CURSOR)); timelineWindow.setCursor(new Cursor(Cursor.WAIT_CURSOR)); timelineWindow.showLatestPage(); timelineWindow.setLocationByPlatform(true); timelineWindow.setVisible(true); autoViewWindow.setTitle("Auto view - JKomasto"); //autoViewWindow.setVisible(true); loginWindow.dispose(); autoViewWindow.setCursor(null); timelineWindow.setCursor(null); } public PostWindow getAutoViewWindow() { return autoViewWindow; } public ComposeWindow getComposeWindow() { return composeWindow; } public ImageWindow getMediaWindow() { return mediaWindow; } // ---%-@-%--- public static void main(String... args) { new JKomasto(); } // ---%-@-%--- public JKomasto() { api = new MastodonApi(); timelineWindow = new TimelineWindow(this); composeWindow = new ComposeWindow(this); autoViewWindow = new PostWindow(this); loginWindow = new LoginWindow(this); mediaWindow = new ImageWindow(); composeWindow.dispose(); autoViewWindow.dispose(); timelineWindow.dispose(); mediaWindow.dispose(); loginWindow.setLocationByPlatform(true); loginWindow.setVisible(true); } } enum PostVisibility { PUBLIC, UNLISTED, FOLLOWERS, MENTIONED } enum TimelineType { FEDERATED, LOCAL, HOME, NOTIFICATIONS, CONVERSATIONS, LIST } class TimelinePage { public TimelineType type; public List posts; } class Post { public String text, contentWarning; public String authorId, authorName; public Image authorAvatar; public ZonedDateTime date; public PostVisibility visibility; public String postId; public boolean boosted, favourited; public Attachment[] attachments; } class Attachment { public String type; public String url; public Image image; } class Composition { public String text; public PostVisibility visibility; public String replyToPostId; }