Everything posted by RSBDavid
-
Rules of This Forum
Hell yeah! This is bad [wagon].
-
Your language of choice
Java for me. I am starting to really get into it.
-
My Current project - Notes Express
Reserved
-
My Current project - Notes Express
Here is a little background on this script. I wanted to create my own note taking program to use on my laptop at school instead of using notepad/word. This is because of two reasons: One, I learn more Java methods. Two, I create something useful. Picture of GUI as of January 25, 2009: [hide=GUI] [/hide] I will post my source here and update on my progress. Log: January 25, 2010 - Source released [hide=Original source] import java.awt.Color; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.DefaultMetalTheme; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.OceanTheme; import javax.swing.tree.DefaultMutableTreeNode; /* Author - David H. * Project: A note taking application * */ @SuppressWarnings("serial") public class notes extends JFrame implements ActionListener{ //Variables String s; static File location = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); final static String LOOKANDFEEL = "Metal"; final static String THEME = "Ocean"; Action selectLine; Date now = new Date(); //EOV section public notes() { //set a title for the application super("Notes Express - A free lite note taking application"); setSize(800,600); JMenuBar mb = new JMenuBar(); setJMenuBar(mb); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); mb.add(fileMenu); mb.add(editMenu); JMenuItem newMenu = new JMenuItem("New"); JMenuItem openMenu = new JMenuItem("Open"); JMenuItem saveMenu = new JMenuItem("Save"); JMenuItem exitMenu = new JMenuItem("Exit"); JMenuItem cutMenu = new JMenuItem("Cut"); JMenuItem copyMenu = new JMenuItem("Copy"); JMenuItem pasteMenu = new JMenuItem("Paste"); fileMenu.add(newMenu); fileMenu.add(openMenu); fileMenu.add(saveMenu); fileMenu.addSeparator(); fileMenu.add(exitMenu); editMenu.add(cutMenu); editMenu.add(copyMenu); editMenu.add(pasteMenu); editMenu.addSeparator(); exitMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); JButton hl = new JButton("Highlight"); JLabel hi = new JLabel("Welcome to Notes Express!"); hi.setFont(new Font("Arial",Font.BOLD,12)); hi.setForeground(Color.WHITE); JTextField keyword = new JTextField(12); JLabel msg1 = new JLabel("Enter the keywords to highlight: "); msg1.setFont(new Font("Arial",Font.BOLD,12)); msg1.setForeground(Color.WHITE); JToolBar tb = new JToolBar(); tb.setBackground(Color.BLUE); tb.setFloatable(false); tb.setBorder(BorderFactory.createLineBorder(Color.BLACK,2)); tb.add(msg1); tb.add(keyword); //temporary method keyword.setText("THIS IS NOT FUNCTIONAL"); keyword.setMargin(new Insets(0,5,0,5)); // JScrollPane sp = new JScrollPane(); DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root"); DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child 1"); root.add(child1); DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child 2"); root.add(child2); JTree tree = new JTree(root); add(new JScrollPane(tree),"East"); tb.add(hl); //create text area to type text into final JTextArea lol = new JTextArea(); lol.setFont(new Font("Arial", Font.PLAIN, 12)); lol.setLineWrap(true); lol.setWrapStyleWord(true); lol.setBorder(BorderFactory.createLineBorder(Color.BLACK,2)); //add textarea and menubar to gui add(lol,"Center"); add(tb,"North"); hl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); openMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog( notes.this ); if( returnVal == JFileChooser.APPROVE_OPTION ) { File file = fc.getSelectedFile(); //lolllllllllllllllllllll FileReader fr = null; try { fr = new FileReader(file); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedReader br = new BufferedReader(fr); try { lol.read(br, notes.this); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //lpolllllllllllllllllllll } } }); //java save file jfilechooser initLookAndFeel(); saveMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setSelectedFile( new File( "Temporary Name" ) ); int returnVal = fc.showSaveDialog( notes.this ); if( returnVal == JFileChooser.APPROVE_OPTION ) { File file = fc.getSelectedFile(); //saveTextFile(lol.getText(), location + "/notes.txt"); saveTextFile(lol.getText(), file + ".rtf"); } } }); } public static void main(String[] args)throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { //required stuff notes note = new notes(); System.out.println(location); note.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); note.setVisible(true); } public static String newline = System.getProperty("line.separator"); public void saveTextFile(String text, String string) { try { FileWriter write = new FileWriter(string, true ); PrintWriter text1 = new PrintWriter(write); text1.println(); { text1.print("Notes typed on: " + newline + now); text1.print(newline); text1.print(text); } text1.flush(); write.close(); } catch (IOException ie) { System.out.println(ie); } } //Graphics Crap //http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html private static void initLookAndFeel() { String lookAndFeel = null; if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel"); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel"); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel"); System.err.println("Using the default look and feel."); e.printStackTrace(); } } } public void actionPerformed(ActionEvent e) { //I am putting this method here because the application requires it, but I use inline action events where needed } } [/hide] Feature List: [ ] = non working [x] = working [x]Save text [x]Open text [ ]Search for keywords [ ]Organize notes in a tree form. [ ]Enhance important facts with prefix symbols -With this feature, if I was to post something like: "**George Washington was the first president of the United States" It would appear in the notes as: George Washington was the first president of the United States "*blue*George Washington was the first president of the United States" would appear as: George Washington was the first president of the United States As you can probably tell, I am still a ways from being finished. I hope to have it finished sometime within the first two weeks of February. If you have any ideas feel free to post.
-
Post and discuss all Jagex Twitter updates here!
And not to mention the new features coming with it: Bloom lightning and more particles!
-
Strange power
@MiokieJJ Why does everything have to be consistent? Jagex have the right to release an update whenever they want. The update this coming week may or may not have something to do with the earthquake. On a tweet, Jagex states "@Laieta_ The significance of the mysterious events of 24/01/10 will all be revealed in due time...". This means that the next update may or may not be a quest or the skill .
-
Post and discuss all Jagex Twitter updates here!
You better hope you have great insurance. :smile: Well I'm calling it FT3 and if I'm wrong, I'll shot Pain in the foot. Ditto, and I will shoot MHL in the foot.
-
Today...
I feel as if I am in third grade when I am in my college freshman Ecology class. We went over the ozone today and afterwards, our professor asked use to write a THREE sentence summary of what we learned. After 15 minutes when two kids said they couldn't figure out what to write, she wrote three sentences and told us to copy them and call it even. I was finished 10 seconds after she told us what to do. I said to myself "I pay over a thousand dollars and this is what I got?". After class I talked with my professor and shared my views. She said that she was under a lot of stress because of personal matters and just wanted class to end a little quicker so she could go and deal with what was going on. She was even starting to tear up.
-
War of Legends - Screenshots and cities.
- Post and discuss all Jagex Twitter updates here!
You *could* use life runes to raise dead = Necromancy :)- Post and discuss all Jagex Twitter updates here!
Perhaps they are removing pure essence and just having regular essence ?- Strange power
What would've made it more funny is if in your chatbox it said "A Wild Snorlax Appears". OT: A lot of people died on pvp worlds from this hehe.- Today...
- Strange power
... or a lot of pissed off ranters rioting rudely in Falador.- Strange power
Is that graveyard some type of cult activity?- Strange power
9.4- 7 = 2.4. 2.4 x 10 - 24. 24 != 400 you == failed you dont understand math, or have you not reached multiplication yet? You don't understand the Richter magnitude scale. a 7.0 earth quake is 10x powerful then a 6.0. and a 8 is 10x more than a 7, therefore a 8 is 100x more than a 6 genious, either your confused, dont know multiplication, or you just took my side and argued against yourself Ok, I admit my mistake. So a 9.4 is 240 times more powerful, but 400 != 240. If you want to continue the argument then feel free to pm me. OT: Until I see a JMod confirming Zaros update, I do not believe it.- Strange power
9.4- 7 = 2.4. 2.4 x 10 - 24. 24 != 400 you == failed you dont understand math, or have you not reached multiplication yet? You don't understand the Richter magnitude scale. a 7.0 earth quake is 10x powerful then a 6.0.- Strange power
9.4- 7 = 2.4. 2.4 x 10 - 24. 24 != 400 you == failed- WoL General Discussion
The name isn;t offensive to everyone. Some people may consider a name like "America" to be offensive.- Post all trivial Youtube videos here
The hell?- Strange power
http://www.youtube.com/watch?v=c0O1oLvgfzo- Something odd
They always release the next update's teaser on a weekend 90% of the time.- WoL General Discussion
FOR THE GHORDE!!!!! <--- new saying for alliance- WoL General Discussion
I am just chillin this round until the next server reset. I have 250k lumber in stock. I used sacrifice and lost my whole population. I used this city mover thing and I am 2 squares from the rank one player.- WoL General Discussion
Since the server will reset again soon, I am just messing around. I am being a lumber producing factory. I make 8k wood an hour. I have a 100k stockppile so far. - Post and discuss all Jagex Twitter updates here!
Important Information
By using this site, you agree to our Terms of Use.