13 ms·
Show HN: Hacker News desktop application in Kotlin/Swing
- des429 9y agoJesus. definitely looks like a swing app
- egocentric 9y agoDefinitely got that swing feeling to it :) Is there any way to customize the theme? I'd love something that's more clean and looks more modern.
- westoncb 9y agoThe only way is to change the Look and Feel, and unfortunately I think 'Nimbus' (which I show in one of the screenshots) is the most modern looking of the built-in Look and Feels. There may be some decent 3rd party options though... Like whatever IntelliJ is using.
- vturner 9y agoNot true, you can get the platform feel easily. I've seen swing do Windows XP through 7 easily. Never tried 10 yet.
- westoncb 9y agoI tried using the platform look and feel on macOS, but it gives a number of important elements tiny heights, including comments, making them unreadable. I'm sure there's a fix but I haven't looked into it.
- vturner 9y agoAh, maybe it's been abandoned for JavaFX as others have pointed out?
- daenney 9y agoYou can get a bit closer to native feel with JavaFX. It's still not there but it at least the default Moderna theme doesn't rock the boat like Swing does. Thankfully JavaFX is pretty easy to customise, it's roughly writing CSS, and there's a few high quality themes out there. Take a look at JFoeniX[0] for example for a material design inspired look. [0]: https://github.com/jfoenixadmin/JFoenix https://github.com/jfoenixadmin/JFoenix
- pjmlp 9y agoYes, there are several ways to custom paint, hence why there were several companies selling components like JGoodies. The problem is that most devs don't bother to read the Sun tutorials and respective UI/UX blogs on java.net, or books like "Filthy Rich Clients".
- _ar7 9y agoThis is why electron is so popular
- westoncb 9y agoAs the author of this—yep, I can agree with that. I'm generally baffled when I see folks complain about Electron's slowness—but that's probably 'cause I started out building Swing apps :)
- thejosh 9y agoAlso the memory usage is killer.
- dawnerd 9y agoI don't get that. Atom is only using 175 megs of ram on my mac. my email client is using more than double that.
- captainmuon 9y agoMemory usage is often a bad indicator of bloat. Especially GC languages like Java and JS will just go ahead and allocate a lot of memory from the OS without using all of it all the time. If you sum the "used" memory of all apps, it will often be more than the available RAM, even though there is no swapping going on. The OS memory management is really clever nowadays. Actually, an app not using much memory may be sacrificing performance by not using a caching opportunity. Unfortunately, apps coordinating how much memory to best use is an unsolved problem, as far as I know.
- mrighele 9y agoIs it really the case ? I would expect the language to expand the size of the heap only if after a GC the amount of free memory is still below a certain threshold.
- donovanm 9y agoI think it has more to do with electron using JavaScript imo. JavaFx exists for a more modern java cross platform GUI
- anon6412 9y agoHas anyone successfully compiled it with the kotlinc command line tool?
- westoncb 9y agoHey anon6412, so this was my first Kotlin project, and I don't really know much at all on the ecosystem. I could check out kotlinc and write up something on how to build with it—I imagine it's just adding ./lib to the classpath, though I'm not sure. There's no package structure to the source.
- marktangotango 9y agoDoesn't look like a regular jtree in the right pane, what did you use for showing the comment hierarchy?
- westoncb 9y agoIt is a regular JTree! —mostly. I am using a custom TreeCellRenderer, which uses a JPanel with some labels on top, and a JTextPane for to display the comment itself (since the HN API gives back comments as html, I use JTextPane to parse/render that html). Edit: it also may look different if you aren't used to seeing the 'Nimbus' Look and Feel—its JTree looks fairly different.
- mberning 9y agoWhat framework does Jetbrains use for all their tools? They honestly look and perform great on every platform that I have used them on.
- stevoski 9y agoJava Swing, with lots of manual tiny tweaks for fidelity.
- jm547ster 9y agoWow I had no idea, assumed it was JavaFX, it has a much nicer feel to it than the other 2 IDEs. Has Swing remained the same or has the API been overhauled since idk, SE6-ish around last I perused? NetBeans certainly has had a nice bit of a facelift last I saw of it. Eclipse I won’t say too much, looks like their splash screen is the only thing has had much of an overhaul.
- pjmlp 9y agoJust tiny improvements, mostly bug fixes. The secret is to read "Filthy Rich Clients" and "Tricks of Swing Gurus", where most of those programming knobs were described.
- ComputerGuru 9y ago"great" is subjective, my preference is for "native" and then you only have to decide what you think/feel looks good just once. JetBrains doesn't look native.
- kevinherron 9y agoSome suggestions: 1) don't start a new project in Swing when you could use JavaFX instead. Since you're using Kotlin, you'd also want to use TornadoFX, a nice DSL for JavaFX. 2) use Maven or Gradle (or hell, any build tool). Don't store artifacts in source control. I was really hoping someone who knew what they were doing was building this after the mini Electron debate earlier this week :/
- westoncb 9y agoHey kevinherron—thanks for the feedback. I actually was aware I could build something nicer with JavaFX, but one of the main constraints on the project was that it satisfy my nostalgia for old Swing apps (particularly the 'Metal' Look and Feel), so I decided to go in that direction. As for building—I agree the current project structure is basically unforgivable :) However, I figured the chances of anyone seeing the project were extremely remote and it was just for fun so I didn't bother with any of the boring stuff. Maybe I'll fix it up a little now though. EDIT: the project now uses Maven.
- kevinherron 9y agoWell, you posted it here, so the chances of someone seeing it got less remote. Now that you've got a build.system in place you won't have to waste time documenting or replying to comments about how to build it :)
- crispinb 9y agoExcuse a quick aside -- do you know of any good examples of real non-enterprisey apps using JavaFX? Java desktop apps seem almost universally awful, but it doesn't seem like it has to be that way. I'd love to see some counter examples (IntelliJ's IDEs are honourable exceptions, but they're a bit of a special case).
- jcpst 9y agoBitwig, an excellent commercial cross-platform DAW, has a UI that is written with Java.
- noncoml 9y agoYou were so preoccupied with wether you could, that you didn’t stop for one moment and think I’d you should! Just joking. Good job. I think it’s been years seen I saw a Java App, and have to say, I am a bit disappointed at how Swing still looks.
- westoncb 9y agoHaha! Thanks! I can't really say this is representative of the best modern Swing has to offer, though, so I hope people won't judge it too much by my joke project ;)
- copperx 9y agoSwing will always look like that. Java FX is the new stuff.
- solomatov 9y agoYou can substantially improve appearance by change the default look and feel to something better, for example your platforms' look and feel.
- PleaseHelpMe 9y agoVery nice app and promising. However, I would the UI would look more "modern" (don't know if this is possible or not). Right now the button and the scrollbar is a bit outdated. The bonus point for me that this is written in Kotlin, not another Electron RAM killer app.
- justboxing 9y agoAsk HN on Show HN: Why is Swing UI still so Ugly ? 2 Decades since it's introduction in 1997 ( I remember being forced to use it in a trading OMS application in 2002), Swing UI looks frozen in time, ugly as ever.
- westoncb 9y agoPart of that is because Java has basically moved onto JavaFX over Swing—and partly it's because I built this specifically to resemble old Swing apps :)
- gruez 9y agofollow up question: why does swing use its own special snowflake design, when it could the OS's native design?
- westoncb 9y agoSwing uses a pluggable 'look and feel' system (essentially themes)—which does include a 'native' look and feel for various OSs, including Windows and macOS.
- AnIdiotOnTheNet 9y agoConsistent look & feel between platforms.
- hota_mazi 9y agoWhich means it sucks and looks weird on all platforms. The story of Swing.
- hasenj 9y agoThe other day there was a post recommending the use of JavaFX. I would really like to see a non-trivial app built on JavaFX in Kotlin, with the following properties: - Does not look ugly. - Is not composed of _merely_ OEM widgets. But includes custom elements, like one would normally see on websites (and by extension, Electron apps). - Is lightweight and response, not just in terms of CPU and RAM, but in terms of user experience (think VSCode vs Android Studio).
- deleted 9y ago[deleted]
- agibsonccc 9y agoDisclosure: I am friends with the founder. Gluon is taking a pretty neat approach with javafx (think reactive native with javafx): http://gluonhq.com/ http://gluonhq.com/ I haven't browsed their repos but if you were to look for anyone promoting jfx it would be these guys.
- kiwee 9y agoI actually did with my company and anyway it was a bad decision. JavaFX and swing customization is really not easy and not well documented. JavaFX uses custom XML which make no sense to be honest when you want to do nice design. And it requires custom CSS too. Additionally, their design are bad(I mean their Java API). We spend a whole year making an app with it, at the end we decided move away from it, like the rest of the java community if fact that do not really support desktop applications anymore.
- AlphaSite 9y agoFX1 or FX2?
- TXV 9y ago> JavaFX uses custom XML which make no sense to be honest when you want to do nice design. I don't see why the custom XML should be a problem. Definitely you are not supposed to edit the .fxml files by hand, especially when you have apps like Scene Builder that allow you to design everything from a GUI. > And it requires custom CSS too. That's true only for a few JavaFX-specific properties. The CSS syntax doesn't change very much. Also, it's not a surprising feature: QT, the C++ GUI framework, also uses custom CSS.
- solidsnack9000 9y agoIt don’t mean a thing...
- westoncb 9y agoHaha I was very confused until: "It Don't Mean a Thing (If It Ain't Got That Swing)" https://www.youtube.com/watch?v=qDQpZT3GhDg https://www.youtube.com/watch?v=qDQpZT3GhDg :)
- j_s 9y agoAdd this to the list! Other ways to read Hacker News | https://news.ycombinator.com/item?id=15310291 https://news.ycombinator.com/item?id=15310291 (Sep 2017, 181 comments) Includes mention of alternate websites, mobile apps, and a pair of CLIs: haxor-news and hn-cli. I'm not sure but this might be the first desktop GUI app for HN I've heard of!
- vturner 9y agoThe HTML5 parsing in Java is awesome now! built a desktop app with Bootstrap 3 recently and the logic in Kotlin, fun stuff. Your Swing metal L&F is great :)
- westoncb 9y agoBtw, this project started when my sister and I were eating at Panera and decided it would be fun to each write an HN front-end. Hers was largely a project to learn React, which you can see here: http://coribeecroft.com/hacker-news-frontend/ http://coribeecroft.com/hacker-news-frontend/ She's looking for work at the moment if anyone knows of someone who might want to hire a somewhat junior but very smart developer with a good sense of humor. See here for more: http://coribeecroft.com http://coribeecroft.com
- harisamin 9y agoVery cool! I made a native macOS desktop client . It does use a web view to render the article but the article list, comments, voting, commencing, login interactions are all native . http://mackernews.com http://mackernews.com
- wcauchois 9y agothis is awesome! i love the mix of age-old apis with a cutting edge programming language. this must've been really fun to code.
- westoncb 9y agoHaha, yep, it was a lot of fun. Especially going back and using Swing after about a decade of using other UI libs—that was a very interesting experience. When I was initially using Swing it was all I knew and at first I thought of all new systems in terms of it. I even tried re-writing a super stripped down version of it on OpenGL way back when: http://symbolflux.com/statichtml/oldprojects/openglguisystem.html http://symbolflux.com/statichtml/oldprojects/openglguisystem... :)
- camus2 9y agoBy the way there is still no HN OAUTH API. There are tricks to authenticate users and send messages but I don't want to share my password with a 3rd party.