Search:

Type: Posts; User: ranjithfs1

Page 1 of 2 1 2

Search: Search took 0.20 seconds.

  1. Replies
    10
    Views
    1,678

    [SOLVED] Re: Reading pgm file

    Answer obtained here: Reading a pgm file in Java - Stack Overflow
  2. Replies
    10
    Views
    1,678

    [SOLVED] Re: Reading pgm file

    I understood what you are asking but even I'm not sure of it. The same thing with whitespace should be true for '#' also. When I opened the file using notepad, I could find some '#' characters. So,...
  3. Replies
    10
    Views
    1,678

    [SOLVED] Re: Reading pgm file

    This is an assignment given to us. The question states that the file may contain whitespace characters along with the image data. The file is an actual pgm file. I opened it with a pgm file viewer...
  4. Replies
    10
    Views
    1,678

    [SOLVED] Re: Reading pgm file

    Adding the following code


    while (true) {
    b = (byte) (d.readUnsignedByte());

    if (b == '\n') {
    System.out.println(" new line");
    ...
  5. Replies
    10
    Views
    1,678

    [SOLVED] Re: Reading pgm file

    I have posted a clearer version of this question here: Reading a pgm file in Java - Stack Overflow
    The maxVal came out to be 255.




    so the max (positive) value a byte can hold is 127

    ...
  6. Replies
    10
    Views
    1,678

    [SOLVED] Reading pgm file

    I need to read a pgm image file. The first few lines contain information like height, width, magic number and maxval. The remaining lines contain bytes which represent the image. Each of those bytes...
  7. Replies
    1
    Views
    477

    [SOLVED] Adding two byte/ short variables

    public class srgf {

    public static void main(String args[])
    {
    short a =1;
    short b=1;
    short c=a+b;
    System.out.println(c);
    }
  8. Replies
    2
    Views
    902

    Re: Nested for loop

    If you would like to do it in another way, you can use String formatting. First build the string using an inner for loop, set the required width and print.
  9. Re: This Code worked on a separate class but does not work on another class

    Are you trying to copy the code from the method player() into method main()
    If so, here is the answer: methods having void type cannot return any values, the return statement needs to be replaced...
  10. Replies
    5
    Views
    921

    Re: calculator program

    You can learn about splash screens in the documentation here: How to Create a Splash Screen (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)
  11. Replies
    4
    Views
    903

    Re: NullPointerException

    I think that I have figured out what's wrong with your code. You have globally declared a String details object and also another String details object in empdetails() which would hide the global...
  12. Replies
    4
    Views
    903

    Re: NullPointerException

    Someone might be able to help you if you tell us what lines 132,110 and 42 are in your program.
  13. Replies
    8
    Views
    1,234

    Re: check for valid argument to a method

    I think that I have understood what you require. But before that let me point out that your do doesn't have an associated while.

    If all that you wish to do is to print an appropriate message when...
  14. Replies
    7
    Views
    447

    Re: Writing to aserializable file

    That isn't possible. Each of the classes that I have created serve a different purpose. One of them contains the algorithm, one of them contains the non graphic user interface and so on. If you were...
  15. Replies
    7
    Views
    447

    Re: Writing to aserializable file

    The first three classes are the classes which together form the test class: one of them creates a new class which has a data member of type 'TicTacToeAlgorithm' and the second class is the class that...
  16. Replies
    7
    Views
    447

    Re: Writing to aserializable file

    I have tested them in another test (different from where I wanted them to be used) and everything worked fine:
    Here is that test class:



    import java.io.*;
    public class delsergame implements...
  17. Replies
    7
    Views
    447

    Writing to aserializable file

    I am getting an error ( IOException ) when I try to write to a serializable file. The object to be saved in turn contains an object both of which are serializable. The following stack trace error is...
  18. Replies
    3
    Views
    791

    [SOLVED] Re: Setting field width System.out.printf

    That was helpful! Thanks! :-)
  19. Replies
    3
    Views
    791

    [SOLVED] Setting field width System.out.printf

    How do I set the fields with with a variable and not a constant? This is what I want:

    System.out.printf("%xs\tPlayer Points\tComputer Points\t Winner\n", "Name");
    Here x is an integer variable.
  20. Replies
    4
    Views
    1,230

    Re: Clearing the screen

    If it is sufficient that my program works on Windows, is there any way ( and more specifically, exceuting it from JCreator) . I mean that my program need not run on all platforms, windows is...
  21. Replies
    4
    Views
    1,230

    Clearing the screen

    Is there any way by which I can clear the screen (terminal window)?
    I used to use the "\u000c" escape sequence in BlueJ and it used to work fine but in JCreator, it displays a box.
  22. Thread: JButton

    by ranjithfs1
    Replies
    4
    Views
    504

    Re: JButton

    Thanks. It's done now!
  23. Thread: JButton

    by ranjithfs1
    Replies
    4
    Views
    504

    Re: JButton

    Here is my modified code:


    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class del1 extends JFrame{
    JPanel panel1;
    JButton button,button2;
    public del1()
  24. Thread: JButton

    by ranjithfs1
    Replies
    4
    Views
    504

    [SOLVED] JButton

    When the following program is compiled:

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class del1 extends JFrame{
    public del1()
    {
    JPanel panel1=new JPanel();...
  25. Replies
    3
    Views
    1,323

    Re: Maximum length of a string

    Thanks for your reply but I couldn't understand much of it. This is what I actually want to type in the editor:


    String str="000000000 1"+
    "000000001 1"+
    "000000002 1"+
    "000000010 1"+...
Results 1 to 25 of 32
Page 1 of 2 1 2