Wednesday 6 November 2013

Java Application for tracking monthly income and balance pt3


Ok, ok I said I'd post the next chapter of the Arduino Starter Kit, but I can't leave this project in half with horrible layout and various fix to do, so here we are.

I fix the layout, improve the readability and add the message box when closing.
For fixing the layout I choose to separate the components into 3 JPanel, adding all three into a GroupLayout set as layoutmanager of the JFrame

The first and the third JPanel are themeselves managed with a GroupLayout, otherwise the second JPanel has a simple FlowLayout because in it there is only the JTable.

The graphical result is the screen down here:



The only fix I need now is to align the third JPanel to center, or move the JCheckBox and the save JButton near the extreme left, aligned with the left edge of the JTable.



To add the message in the closing action when have unsaved modification, I inherit the WindowListener and in his windowClosing() method I managed the Exit. For doing this you must set the default closing action of the JFrame to DO_NOTHING_ON_CLOSE , and change when it need.
I don't have really implemented the others methods because I don't need them in this project. But I must put their implementation in my code or there is a compiler error caused by the not fully implementation of the methods present in the WindowListener interface.

If you want to see the full code is still on my GitHub repository . Now, as you can see up here, I need to align the JPanel3 to center, and change the JLabel jlabError with a JOptionPane message, and maybe improve readability and shortening the code, but these are minor improvement so next evening I can work on next chapter of Arduino for real.

Ygy Freezone

No comments:

Post a Comment