Recently I've begun working on a custom launcher that I'm trying to make as user/owner friendly as possible. I won't claim it's good. I mostly consider it practice as I'm not very familiar with the Java Gui (JFrames, JPanels, everything). I've also recently started trying to improve my knowledge of regex, so there's quite a bit of that in there(even though I may be overusing it). I've only been working on it a couple days, but here it is:
Honestly if you don't want to read ignore this, I added almost everything I did
Spoiler for INFO:
-Create Base (Jpanel, JFrame, actionHandler etc.)
-Add basic buttons and functions (close and minimize button)
-added dragging for window (had to do this since I setLayout as null and or undecorated as true)
-Created XML file/filled with dummy info as test
-set up so xml file will be downloaded via a link or a local copy used (this is temporary, plan to switch to an RSS Feed later)
-Addition methods used
------Format date with regex(View XML date/screenshot of launcher to see)
------added custom ellipsis method if text is too long (ellipsis = "..." symbol)
-----------did this because JLabel did not do it automatically after html was added. This was an unnecessary pain
because I decided to use StringWidth instead of estimating by a number of characters because I'm picky
------added getLine method to return a string of second line of a JLabel as seen (had to do this so ellipsis was only on second line)
-Add Notifications for recent Updates
------added int to limit shown notifications
------Enlarge/Shrink Notifications for displaying info
------add URL button that only shows if link exists in xml file (or if it's not blank)
-----------if "https://" is forgotten it will be added to the link before opening
------added close button for each notification
------added title/description/date (grabbed from xml file)
-----------made a "\n" in the description in xml skip a line in the JLabel (originally just displayed it on the button)
-----------made adjustments to getLine method so that it'd factor in \n skipping lines
------added a method to re position notification buttons (whether enlarged or closed)
------added support for html in previously created methods (had to adjust ellipsis method so the tags wouldn't interfere with StringWidth (more regex))
------date moved/underlined when expanded and moved back/underline removed when shrunk (more regex, but could have used other ways)
TODO:
-Add Play button that downloads client/updates (Needs downloading methods and everything else)
-Add a progress bar to show how far current download is.
-Add Title for Launcher itself (forgot this in the beginning, but it's easy to add)
-Server online text
-Add functionality to the menu button in top left
------Add links to the menu that I plan to make pop out of the left side of the launcher
----------notifications be moved when opened, moved permanently, or menu opened over them?
------make menu close when clicked anywhere else (already have mouseListener set up)
------Add some nice icons to each button, like a shopping bag for donate, or a house for website home etc.
-Add download cache button? thoughts? would this be a good addition or naw?
-Add HoverButton icons (This is easy, but I don't have the icons and I'm not artistic so this can wait)
-Add Tray icon for following links
-add System Notifications when new client or server update is available?
------If I do this, make it so you can disable these for client/server or both
------If launcher is open, have lowest button removed, and newest one added on top
------add option for close button to instead add to tray
------add settings button in menu with a popup to customize all these options ^
-have launcher save preferences
LAST: Rewrite/clean parts I know can be done better (already quite a few things)
This is just the xml file i used filled with garbage to test everything out
Spoiler for XmlCodeExample:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<updates>
<update>
<date>january 5 2018</date>
<title>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ</title>
<description>1<htmlData><![CDATA[<u>hello how are</u>you<br>doing this fine <font color='red'>day? <u>I eat</font> waffles when I wake up no matter where it is</u>]]></htmlData></description>
</update>
<update>
<date>5-17-18</date>
<title>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ</title>
<description>2hello how are you\ndoing this fine day? I eat waffles when I wake up no matter where it is</description>
<link>http://www.google.com</link>
</update>
<update>
<date>5/21/18</date>
<title>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ</title>
<description>The Quick Brown Fox Jumps Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog.</description>
<link>www.google.com</link>
</update>
<update>
<date>march 10 19</date>
<title>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ</title>
<description>The Quick Brown Fox Jumps\n Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog. The Quick Brown Fox Jumps Over The Lazy Dog.</description>
<link>google.com</link>
</update>
</updates>
I like to believe it'd look a little nicer with some actual icons and whatnot made for it by someone who knows what they're doing, instead of whatever I could get my hands on
Spoiler for Media:
If anyone is interested in the progress I make I can continue to post updates, but let's be honest, it's nothing special, but as someone who has self-taught 90% of what I know, I'm proud of it so far.
I know not a lot looks like it's done, but it took quite a bit of effort to get the notifications the way I envisioned it, since I refused to settle on anything else
Yikes are you using swing? What ancient tutorials are you following lol
That background is hideous.
Best of luck, I remember how hideous my first guis were.
Yea I'm using swing, I'm basically just using whatever I can find via google as reference to be honest. what do you suggest instead?
also yea I also just grabbed whatever for the background, as I figured I'd find a better one that matches the rest of the launcher once I finished
Yea I'm using swing, I'm basically just using whatever I can find via google as reference to be honest. what do you suggest instead?
also yea I also just grabbed whatever for the background, as I figured I'd find a better one that matches the rest of the launcher once I finished
I'd recommend JavaFX because you can style the GUI using CSS and you can also use controllers to follow MVC design pattern.
Swing is old as shit, completely dead, layouts are trash, and styling is a nightmare.
I also always use scenebuilder I know some people don't like it but I love it. I drag and drop shit and make the ui in a few seconds. It's the implementation of the tool that takes a while.
If you like Kotlin there's https://github.com/edvin/tornadofx I don't use it cause I've used JavaFX forever. Also you can create custom components in scenebuilder no one knows about.
Last edited by CrazyPanda; 05-17-2018 at 04:53 AM.
I'd recommend JavaFX because you can style the GUI using CSS and you can also use controllers to use MVC design pattern.
This tool took me 2 days to create the whole thing. The layout took me 5 minutes, the stylesheet I use for all my programs its like a black spotify theme.
That does look really nice, once I'm done with this, I'll probably rewrite it with JavaFx instead of swing then. I like css (though I'm not very good at it yet), and more learning couldn't hurt
EDIT: Scenebuilder looks nice, but I'd most likely write everything by hand. Although it'll probably take longer, that's just the type of person I am
At least you'll learn how to style websites too haha
I used to as well but after you write a 100 guis its gets very repetitive lol
I looked at a webpage that highlighted main differences between swing and JavaFX and to be honest I might just switch over to JavaFX now instead of continuing with swing. With adding properties for events, and easier animation (I want to add an animation to the menu button when it opens the menu) it seems worth it
I looked at a webpage that highlighted main differences between swing and JavaFX and to be honest I might just switch over to JavaFX now instead of continuing with swing. With adding properties for events, and easier animation (I want to add an animation to the menu button when it opens the menu) it seems worth it