User Profile

Collapse

Profile Sidebar

Collapse
rotaryfreak
rotaryfreak
Last Activity: Feb 29 '12, 05:24 PM
Joined: Oct 25 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • rotaryfreak
    replied to System Time on Jframe
    in Java
    you can use the Gregorian Calendar class to create an instance of that class and then extract the data that you need from that object

    http://docs.oracle.com/javase/6/docs...nCalendar.html

    once that is done, you should probably create a JLabel and set the text as the date and time that you want. You will then add it to a JPanel inside your JFrame.

    Something like this:


    ...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to ArrayList Question?
    in Java
    what was the code that through this exception?
    See more | Go to post

    Leave a comment:


  • your best bet would be to use a java excel library

    http://jexcelapi.sourceforge.net/
    this should get you started...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to Advice for a client/server application
    in Java
    This website helped me when i was building my client/server application.

    http://www.oracle.com/technetwork/ja...et-140484.html

    it shows the client and the server and some great examples...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to Java swings
    in Java
    if you want to have your table reflect changes once the user manipulates it, you can apply the observer pattern

    http://en.wikipedia.org/wiki/Observer_pattern

    or you can simply call update() or updateUI() on your JTable every time the user manipulates the table.

    i would also recommend that you refactor some of your code into separate classes so it's a little more organized. For example, i would have one class...
    See more | Go to post

    Leave a comment:


  • would you be able to provide some code that you have tried? i believe if you are using a layout manager, then the buttons should move around accordingly. If you are not using a layout manager and placing the components on the frame using x,y coordinates then you will have to update the location of each component separately
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to splitting string
    in Java
    I would do it as follows: convert the string into a character array and then using a for-loop, insert a "/" at every 4th position (if your counter starts at 0)
    Code:
    	public static String divideString(String sampleString, int breakPosition){
    		
    		char[] charString = sampleString.toCharArray();
    		String newString = "";
    		
    		for(int i = 0; i < charString.length; i++){
    			if(charString.length
    ...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to Rational Numbers
    in Java
    what you can do is actually use the next nextLine(); method which takes the whole line the user entered into a string. If you decided to do this, you will have to parse out the irrational numbers you want, which could be cumbersome if you're not familiar with java regex... but it can still be done.

    From my experience, the easiest way would be the way i described above. This way, when you prompt the user for the first irrational number,...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to Infinite Loop in general output
    in Java
    one quick thing you can do is:

    Code:
    catch(InputMismatchException e)
    {
    e.printStackTrace();
    System.out.println(e.getMessage());
    }
    printStackTrace () will give you the line which gave you the error
    e.getMessage() will help you in determining why you got that message

    i have not run the code, but i would have to say that your while-loop is probably not working as you expect....
    See more | Go to post

    Leave a comment:


  • the problem with the code you gave as an example, is that the value of N will never be 0 or 1 and because of this, your value of N is continuously growing until your machine runs out of room on the stack... hence the StackOverFlow exception.

    a closer look at the problem will actually show you how to solve it:
    in order to use recursion, you need to call the same function but gradually decreasing your value until it gets to zero....
    See more | Go to post

    Leave a comment:


  • i've never used the ButtonHandler class before so i'm not quite sure how it's supposed to work, but i have gotten events fired off after clicking a button. here's how i did it:

    for each button:
    Code:
    JButton searchButton = new JButton("Search");
    searchButton.addActionListener(this);
    that's pretty much all you need for the button and now for the action listener:

    Code:
    public void
    ...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to Java - Error trap if file does not exist
    in Java
    I'm happy to see a non-developer trying to learn something about coding :). 2 things though, you should probably use the code tags (denoted by the # symbol) to help display the code properly, and you should probably post this topic within the javascript forums. Take a look at this web site, it may help you out

    http://www.daniweb.com/web-developme...threads/272293

    best of luck...
    See more | Go to post

    Leave a comment:


  • rotaryfreak
    replied to comm failure
    in Java
    if your stacktrace is being shown to the user, you probably have a try-catch block which looks like this:

    Code:
    try{
      something
    }
    catch(SomeException e){
      e.printStackTrace();
    }
    if that is the case, simply remove the e.printStackTra ce() method and replace with some other error-catching code. It may be helpful if you post the actual code which is giving you this error to further analyze...
    See more | Go to post

    Leave a comment:


  • what's a good regex for replacing ' followed by any character

    Hi,

    I've been trying to parse words like it's, can't, etc. so that all i'm left with is the root word i.e it for the word it's and can for the word can't.
    This is what i have tried so far:

    Code:
    String regex = "('.*$)|('[a-z]+)|('(\\w)+)";
    sadly, nothing is working... what am i doing wrong?

    thx
    See more | Go to post

  • how do i merge two lists into one list and delete elements from first list

    Hi,

    I have two map lists

    Code:
    //reads in a file which has a serialized object
    Map<String, List<Integer>> list1 = getListFromSerializedObjectFile(list[i+1]);
    						Map<String, List<Integer>> list2 = getListFromSerializedObjectFile(list[i+2]);
    these lists are not necessarily the same size but the goal is to merge list 2 with list 1 in such...
    See more | Go to post

  • rotaryfreak
    started a topic How to parse html
    in Java

    How to parse html

    Hi,

    i previously worked on a program, written in c#, and a library was used to parse html. If i remember correctly, the library did two things: 1) it removed all html tags from the document and 2) converted the input stream to a string. I would like to do the same with java but the few libraries i found online dont seem to remove html tags, they just seem to clean up the html code so that the tags all match up with each other....
    See more | Go to post

  • p.waitfor does not wait for process to finish before starting another process

    Hi,

    I'm creating a java program which will run other executable .jar files and the order of how these other jar files runs is important. I need to run 3 jar files. A.jar, B.jar, and C.jar. In my main program which will control the execution of my other jar files, this is what i have:

    Code:
    public static void main(String[] args) {
    
    Program.processRequest(settings.ini)
    
    }
    //the settings.ini
    ...
    See more | Go to post

  • How do i run jar files from within a java program?

    Hi,

    I have created several projects using eclipse and java. Each of these projects has a runnable .jar file. I would like to create one java program which would call each of my .jar files, kind of like a batch sequential system where one jar file would execute only after the previous one has completed.

    Code:
    public static void main(String[] args) {
         call jar file 1
         call jar file 2
    ...
    See more | Go to post

  • How can I create a multi-dimensional hash table?

    Hi,

    I'm new to ruby and i've been experimenting on different ways on how to do this, but sadly nothing is working. I would like to create a multi-dimensional hash table in which i can access my members so that the output looks like this

    [Key] [value1] [value2] [value3] [value4]
    key 1 some val some val some val some val
    key 2 some val some val some val some val ...
    See more | Go to post

  • Getting started with mobile development for smart phones

    Hi Everyone,

    I am a software engineering student and in my final year, we will be required to work on a year-long project of out choice. My team and i would like to develop a smart phone application (blackberry, iphone and android). I have browsed the internet and i havent really found the answer to my question, hopefully someone here will be able to help me. If i want to develop my app so that it can run cross-platform on blackberry,...
    See more | Go to post
No activity results to display
Show More
Working...