Bit of Java GUI
It’s coming to the end of the university holidays (well actually it isn’t, my term doesn’t start until October!!) and I felt as if I should at least look over some things I learnt in the previous year. (un)Fortunately I couldn’t be bothered and decided to start teaching myself something I want to do last year, program a GUI.
Now at first I thought this was rather difficult but in actual fact it isn’t. I am not as if an expert or anything or created a program which is rather brilliant or does any particular function but I have managed to create a menu bar and a button which actually do something. My hope is to build on this and be able to implement them more cleanly and effectively. Here is the code anyway.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TestingButtons implements ActionListener { private JFrame frame = new JFrame("Tom's Program"); private JMenuBar menuBar; private JMenu fMenu, hMenu; private JMenuItem aItem, eItem, dItem; private JButton popBtn; private JLabel writing; public TestingButtons() { //menu menuBar = new JMenuBar(); fMenu = new JMenu("File"); hMenu = new JMenu("Help"); eItem = new JMenuItem("Exit",'e'); //the e provides the alt+e shortcut aItem = new JMenuItem("About",'a'); dItem = new JMenuItem("Does Nothing"); //buttons popBtn = new JButton("Produces a pop-up"); popBtn.addActionListener(this); //label writing = new JLabel("Click here"); } public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if(command.equals("Exit")) { System.exit(0); } else if(command.equals("About")) { String title = "About"; String description = "This program was created by Tom McKee as a test to say as to what would happen. If you are reading this then the about works fine"; JOptionPane.showMessageDialog(null,description,title,JOptionPane.INFORMATION_MESSAGE); } else { String title = "Greetings"; String description = "Welcome to my first GUI program!!"; JOptionPane.showMessageDialog(null,description,title,JOptionPane.INFORMATION_MESSAGE); } } public JMenuBar createMenuBar() { eItem.addActionListener(this); aItem.addActionListener(this); fMenu.add(dItem); fMenu.addSeparator(); fMenu.add(eItem); hMenu.add(aItem); menuBar.add(fMenu); menuBar.add(hMenu); return menuBar; } public JFrame setupFrame() { frame.getContentPane().setLayout(new BorderLayout()); frame.add(createMenuBar(),BorderLayout.NORTH); //frame.add(writing,BorderLayout.NORTH); frame.add(writing,BorderLayout.SOUTH); frame.getContentPane().add(popBtn,BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); return frame; } public static void main(String[] args) { TestingButtons test = new TestingButtons(); test.setupFrame(); } } Unfortunately the code block on this here word press is shit so I used block quotes all indentation has fucked off basically. Anyway just thought I would mention this and see if I could built on anything else. I suppose I should look over all those data storage things as well... |
Leeds Festival 2007
After this entry I will actually be more or less caught up with my summer up to this point in terms of travelling etc. Anyway…August always brings one great thing - the bank holiday weekend in which Carling Leeds Festival resides, only this year it looked like it was going to be a complete wash out due to the crap weather of the summer. Luckily the weather ended up being amazing for the entire weekend and the camp site was dry and not muddy (unlike Reading, but that’s more to do with the fact that it is based on a flood plane, next to a river).
Did the standard thing of getting the early permit pass so can get a decent pitch and an extra day of drinking. On arrival of me and Duncan we discovered Duncan couldn’t get in easily as he was working for Oxfam this year but luckily that all got sorted out and during this mix up we met Fintan (aka Fin) who camped with us for the entire weekend. It turned out Fin went to university with one of my old school friends and he was a cool bloke so no hassle there. This first night was spent basically get drunk.
Thursday arrived and with it it bought more drinking. The day was very hot and we spent most the day getting pissed and the night going round being rowdy - well me and Brown went round being rowdy, everyone else kind of went to bed and Fin had to work.
Friday was spent seeing Gym Class Heroes, The Little Ones, Smashing Pumpkins, CSS and The Klaxons. This day was also mainly dedicated to getting drunk as well, are you beginning to see a bit of a trend coming along? I was only really impressed with Gym Class Heroes and The Little Ones; CSS seemed to be missing something, Smashing Pumpkins mainly played new songs and The Klaxons couldn’t get the crowd going.
Saturday would of been spent drinking a lot but I ran out of beer, luckily some of my friends hadn’t so could drink some of theirs. I went to see Gogol Bordello, Interpol, Kings of Leon and Ash. Gogol put on an awesome performance as standard (go see them if you can) and Kings of Leon were great as well. I didn’t really see enough of Interpol or Ash to have an opinion really.
Sunday was spent being mainly sober but having a few beers and seeing The Shins, The Swing Movement, Arcade Fire and Red Hot Chili Peppers. All of these bands were amazing and should all be seen live at some point (although the Chili’s set wasn’t as good as when I’ve seen them previously). I doubt you have heard of The Swing Movement, but they are a local Bradford band who sound rather indie on their recorded tracks (myspace (standard)) but live they are pretty rocking - I like Jigsaw the most.
During my time at Leeds my friend brown (who has ginger hair) got really drunk and got a mohawk hair cut; we tied up some random and he got tea-bagged; tried to have 3-legged race with 8 of us tied together; went on the carpet of doom (ground sheet held between group of guys which is then used to fling someone into the air); a friend drank his own piss; started lots of fires; took shits in cups; pissed on everything in site; stole and created the stealth tent.
All in all a very good Leeds Fest, if only the line up was better though as the camp site was what pulled it all through.
Tour de California
So as promised, here is a little entry about travelling around California. This was a very last minute holiday as the weather here in the UK was supposed to be amazing this summer and it ended up being a complete wash out (literally). So me and the family set off to America, our first destination being San Francisco. I really wanted to visit here mainly to go to the Amoeba record store but also due to how cool it is.
Anyway arrived in San Fran, made it to the hotel then went to find somewhere to eat. Not a lot happened really as we had all been up for about 28 hours and where shattered so had an early night. The next day went round and did a little exploring; picking up a 3 day pass for the trams and buses as we did so. It was really nice to just look around the place as it is so nice and it wasn’t very hot due to the sea breeze.
In the afternoon we headed uptown and went to the Amoeba record store. I have never been in a record shop with so much vinyl or just CD’s. It was all laid out in a huge room and it was just mind blowing. I didn’t actually pick up any records but did get some of the Bill Graham Presents limited edition Fillmore posters from the Fillmore music venue around the corner.
The next few days in San Fran were generally spent looking around, shopping, going to Alcatrez (which was very good indeed and should be visited by everybody at least once) and eating some very nice meals.
Our next destination was Monterey where we would be spending 5 nights. When arriving we soon discovered it wasn’t the sort of town we expected. Admittedly it was very nice but everyone seemed to go to bed at 10pm, making the town pretty much deserted. Whilst here though we did manage to go to Carmel - a very nice place indeed with even nicer beaches - and go to pebble peach golf course and find the Del Monte headquarters.
After a very slow few days in Monterey it was finally time to move onto our next destination - Santa Barbara. Unfortunately we were only spending 2 nights here, which equated to about 1 full day because of travelling. This turned out to be a real shame as Santa Barbara is quite beautiful with some nice beaches.
Our finally destination in the little tour was Los Angeles. On arrival we couldn’t actually get into our hotel because some film featuring Will Smith was being filmed there, but we soon got over that. We very quickly discovered that you have to drive everywhere in LA as it is so big and the public transport is diabolical. Did the usual things of doing a tour of the star houses and visiting Universal Studios but didn’t really have time to do anything else such as visit some of the beaches or have a proper explore of this city where everything seems to happen.
All in all it was a very good tour of California but we all wanted to stay a little longer and visit San Diego as everyone we had spoken to had said it was absolutely amazing and was a very nice city indeed. I would like to return at some point and visit San Diego and possibly go back to San Francisco as I just loved that place.
Been Busy and Away
So I haven’t updated this blog recently for a few minor reasons. Firstly is that I have been working back at the brewery to make up a bit of money as I was/am skint from a year a university. This stopped about a month ago as I had other things to do and ended up spending a lot of the money I earned on a 80gb iPod.
Second reason for the lack of update - I went travelling with the family (nothing like a free holiday) in California. Went to San Francisco, Monterey, Santa Barbara and Los Angeles. It was really good and I’ll do an update on it at some point soon.
Final reason for the lack of update is that it was Leeds Festival this weekend and so have not had access to a computer. Again, I will be doing an update on in this about how I didn’t really see any bands and just got pretty drunk instead.
These 3 reasons combined with the my general idleness on this blog has mean that it has not been updated for a while. This is probably quite strange considering how rubbish this summer has been in terms of weather.
Also keep an eye out for an updated version of the hardcorelife and I want to update the layout of this blog because I think it is pretty crap and unimaginative.

