Subscribe to Grim's Projects        RSS Feed

Linux Java Interface

Icon 2 Comments
*sigh* again a slave to my ideas which I surely won't complete, but intermittently advance. If you've read prior posts then you know about my Java OS idea. Well, sadly I gave it a name, which meant I had to do something more with it. I call it Mocha (play on words delight everyone).

Time for the YouTubes.

So, that's how it works. Here's a photo:

Attached Image

Why does it look different? I'm not using the Nimbus Look & Feel as before. Rather I'm using one known as insubstantial 7.1. Wanted to see what else I could do. I also got the vertical tabs working just like I wanted. Sadly, there is something amiss with the code thus far and it takes a bit of explaining.

I use Opera as my browser, and I find how the browser handles tabbing very intuitive (so I sought to reproduce it). This is the behavior I've defined:
  • When a tab is added it should be last in the tab navigation history (very top of the stack)
  • When a tab is selected, its previous position in the history is discarded and brought to the bottom (where the bottom of the stack denotes more recent tabs)
  • When a tab is removed, if it was the currently selected tab, the next selected tab is whichever is at the bottom of the remaining stack

As you can observe in the video that behavior does work. However, it doesn't work correctly. In order to program this behavior I had to add a ChangeListener interface to the JTabbedPane. There is an odd thing about how JTabbedPanes behave though (outdated reference and supposedly fixed, but I'm not entirely convinced). The interface only defines stateChanged, but that could mean tab added, tab selected, or tab closed (dependent on how JTabbedPane chooses to behave by default). The code for add and selecting does work properly. However, when I close a tab using the small JButton. The stateChanged event will fire and the method will disrupt the navigation history, sometimes even introducing IndexOutOfBoundExceptions. I tried using the synchronized keyword as a "maybe." It didn't work, though I can't say if it's because Swing isn't thread-safe or I'm misusing the keyword. The workaround I managed seems to work coincidentally (i.e. luck). I'm confident that the workaround would randomly fail given some sort of thread timing issue.

I'll post the code in the near future in the hopes someone might see what I'm doing wrong.

2 Comments On This Entry

Page 1 of 1


11 September 2012 - 11:09 PM
Made it sexier, hurray YouTube!


24 September 2012 - 12:11 PM
I think this is going to turn into a video documentary of upgrades.
Page 1 of 1