User Profile

Collapse

Profile Sidebar

Collapse
BSCode266
BSCode266
Last Activity: Feb 5 '09, 06:04 PM
Joined: Jan 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • BSCode266
    replied to Recursion...Its hard to grasp. Help.
    in Java
    I am not even close to you guys skill level, but isn't one important thing of writing code keeping it readable?

    Greets,

    ~BSCode266
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to Recursion...Its hard to grasp. Help.
    in Java
    Well reverse3 isn't recursive. It is making a call to reverse1. For it to be recursive it should call itself.

    Code:
    return reverse1(a/10, 10*rev+a%10);
    A little sidenote, you really should try to avoid using variables with names like "a", "b", "c". Name them to the thing they represent just like Jos did, call it "num". Now your code is small but if you develop this as a habbit you are going to be in a...
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to Recursion...Its hard to grasp. Help.
    in Java
    I think you are doing it wrong. From what i understand what is important in this excercise is the recursion. As it is the reversing of digits i think the goal is to have one method do it all.

    Take a look at this simple example with a global counter. In this counter you would have to put the length of the int.

    Code:
    void method( int counter){
         if(counter == 0){
             //Spot where you return the reversed int
    ...
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to Using variables inside for loop
    in Java
    Do you really want to go through the for loop 4 times? If not you could always use a break; And i don't see whats wrong with the if(i==0) if you are only going to use it once.
    See more | Go to post

    Leave a comment:


  • Thank you very much Jos. It was the preferredSize of the panel which was obviously way to small. Because if the panel is bigger then its preferredSize it doesn't have to scroll even tho there are object outside of the screen.

    Thanks alot!!!!

    Kind regards,

    BSCode266
    See more | Go to post

    Leave a comment:


  • I really could use some help. Still haven't been able to find a solution for this.

    Does anyone perhaps have a sample of a preferredSize method for a custom LayoutManager which would work with a JScrollPane?

    Desperately in need of help,

    ~BSCode266
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to I'm new, basic conversion question
    in Java
    If you want to make sure there are no letters or any other symbols I would suggest the use of a method in the Character wrapper class.

    Example:
    Code:
    //Loop just as the previous example to go through all args.
    for (int i = 0; i < args.length; i++) {
         //Temporary String to save the digits in.
         String temp;
    
         //Loop through a single args.
         for(int j = 0; j < args[i].length();
    ...
    See more | Go to post

    Leave a comment:


  • I have done the following after your response:

    Code:
    JViewport viewport = new JViewport();
    viewport.setSize(frameWidth, frameHeight);
    viewport.setView(panel);
    
    JScrollPane scroll = new JScrollPane(viewport);
    This does display the upper elements of the panel but still does not scroll. I am not really that familiar with the JViewport and googling on it doesn't really give great examples....
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to Problem in a simple program
    in Java
    I'm missing line numbers, what line is exactly 83?
    See more | Go to post

    Leave a comment:


  • Code:
    cb.setBackground(prompt.style.backgroundColour);
    This probably is the reason it isn't greyed out. I never use AWT components, i love Swing better.

    Greets.

    ~BSCode266
    See more | Go to post

    Leave a comment:


  • BSCode266
    started a topic Layoutmanagers, JScrollPane and setLayout(null)
    in Java

    Layoutmanagers, JScrollPane and setLayout(null)

    Hey everyone,

    I'll cut right to the case. I have a JPanel and i call setLayout(null) on it. Simply because I would like to position everything myself and haven't seen a handy manager yet. Now i need to add this panel to a JScrollPane and this is where all the trouble starts. The JScrollPane simply doesn't like the absence of a LayoutManager.

    I have been trying to puzzle through this for hours now and could use some help....
    See more | Go to post

  • BSCode266
    replied to Problems with arrays and pointers
    in C
    It seems i already found the answer, for people who are searching for the same answer here is the solution:

    Code:
    //Before this was Slot* instead of Slot**, meaning that i was conferting it.
    Slot** ForgeScreen::getSlots(){
    	return slots;
    }
    Code:
    //Before this was Slot* instead of Slot**, this has to change because the return value of the get method has changed and we dont want to make
    ...
    See more | Go to post

    Leave a comment:


  • BSCode266
    started a topic Problems with arrays and pointers
    in C

    Problems with arrays and pointers

    Hi,

    This is some code in the first class:

    Code:
    //the array of pointers
    Slot *slots[2];
    
    //the get method for the previous array
    //The first error occurs here:  error C2440: 'return' : cannot convert from 'Slot *[2]' to 'Slot *'
    Slot* ForgeScreen::getSlots(){
    	return slots;
    }
    Slot is another class i defined of which i want 2 objects.
    ...
    See more | Go to post

  • BSCode266
    replied to XML serialization
    in .NET
    Thanks for the article. I wanted it to be easy to read for Humans.

    ~BSCode266
    See more | Go to post

    Leave a comment:


  • BSCode266
    started a topic XML serialization
    in .NET

    XML serialization

    Hey,

    Right now i am using serialization to xml and i looked around a bit but couldnt find the solution so i thought i'd ask here. My "problem" is that the xml i serialize doesn't look as it should but appears all in one big line. I have been trying to find out how to tell the serializer to do this correctly but couldn't find it.

    Does anyone know how to do this?

    Thanks in advance,

    ...
    See more | Go to post

  • Code:
     
    
    String s;
    
    if(s != null){
     here you go;
    }
    I think this should work.

    BSCode266
    See more | Go to post

    Leave a comment:


  • Ah okey, thank you once again Jos. I just wanted to know what i was doing was acceptable. :D

    BSCode266
    See more | Go to post

    Leave a comment:


  • BSCode266
    replied to Please Help Me, Basic Java
    in Java
    I am glad that you worked it out all by yourself. And sorry if i just looked like a smart-@ss. I truly wanted to help you out, just couldnt find the thread.

    BSCode266.
    See more | Go to post

    Leave a comment:


  • Would it be smart to use a txt as some sort of database.

    Hey everyone,

    Right now i am making a program for children which are physically challenged. The purpose of this program is to have children express feelings by playing. So in this game i will need alot of objects out of the real life but also fictional ones. About 100 objects for now. I have made up a menu-structure so that this can be fully operated with just 2 buttons. Because of this i had to group objects together in categories....
    See more | Go to post

  • BSCode266
    replied to Scrollbar
    in Java
    The way i have used it before isnt probably the best way but it works. You can add the textarea to the scrollbar. And then the scrollbar to the panel.

    i think its just one of the scrollbar.add() method.

    BSCode266
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...