nanosani 20 Technize.net addict Team Colleague

I'm in need of determining and implementing the LookAndFeel of the operating system default within a swing frame, whatever that default may happen to be (and without using the string "com.sun.java.swing.plaf..." in the code whatsoever. When simply leaving the UIManager.setLookAndFeel() as is when creating the frame, the correct OS default doesent show up. I'm assuming that Java swing components like to have a LookAndFeel that is java default, not operating system default...

nanosani 20 Technize.net addict Team Colleague

:rolleyes: :rolleyes: :rolleyes: :rolleyes: :cry:

nanosani 20 Technize.net addict Team Colleague

:rolleyes: :rolleyes: :rolleyes: :rolleyes: :rolleyes:

nanosani 20 Technize.net addict Team Colleague

I am doing some very nasty computation using java but it always gives me a java.lang.OutOfMemory Error,after this nothing on the GUI works.i think its ok to have that error but atleast things should work afterwards.

Please Advise

nanosani 20 Technize.net addict Team Colleague

Any api function in java that allows a program to open and edit the contents(preserving the formatting of the file such as the font, size etc) of the file within a gui?

nanosani 20 Technize.net addict Team Colleague

Can anyone please tell me how can I divert my keyboard inputs to any file or any string ... rather than the monitor ... can anyone code a sample statement for me thanks ..

nanosani 20 Technize.net addict Team Colleague

I am using windows 2000 pro for a long time. I have also used win 95,98, Me and XP. I dont know why people prefer win XP. I think win XP has some graphical effects and nothing else.

Should I be using win XP or continue using win 2000 :?:

nanosani 20 Technize.net addict Team Colleague

I didnt even know about RSS feeds before .... LOL

nanosani 20 Technize.net addict Team Colleague

Amphibian --> slade

nanosani 20 Technize.net addict Team Colleague

Thanks for the great ideas ... I have started implementing like that ... I'll tell you if I get some difficulties.

nanosani 20 Technize.net addict Team Colleague

Thanks for all that ... but I needed to know how it works... cuz even if I dont use it in my code ... its not good that I dont learn it.

nanosani 20 Technize.net addict Team Colleague

While reading a topic in my book on comparison between java and c ++ ... I read one difference .....

java statements can be labeled while c++ statements cant be. Can anybuddy tell the use of labeling in java?

nanosani 20 Technize.net addict Team Colleague

These are basic concepts that you should have know by now ... anywayz ...

string to integer
Integer.parseInt("string");

integer to string
String s = "" + integer;

Rest do it yourself ... I have given you the basic ideas.... others are same as above.

nanosani 20 Technize.net addict Team Colleague

Show your effort not your homework...

nanosani 20 Technize.net addict Team Colleague

Hey Dani .. this is Sani!
I suggested it some weeks back ... but now I have some other idea .. I thought I'd better convey it to you.
Cant you have a contest in every forum ( like tutorials n snippets ). But don worry about the money ... I thought of a way round .... just give some reputation points to the contest winners ... you can arrange monthly contests so the reputation points are not thrown away frequently ....
I have given my idea ... n now its up to you to think of what you have to do.
Sani.

nanosani 20 Technize.net addict Team Colleague

Just go on with the methods you have written .. my motto is " when you dont have anything in your mind ... just start writing or typing ... " and the results I have got are .. that I have ended up with a complete solutions .... Best wishes.

nanosani 20 Technize.net addict Team Colleague

If I want to add a plugin which I have designed after I have written the software ... how should I do it. Suppose I designed a word pad ... and then I designed a spell checker ... how should I add the spell checker to my word pad to get it working :?:

nanosani 20 Technize.net addict Team Colleague

see the JTable methods in the APIs... you'll find how to resize and insert in the cells of the table.

nanosani 20 Technize.net addict Team Colleague

(repartition + reinstall).equals("solutionToYourProblem"); LOL

nanosani 20 Technize.net addict Team Colleague
public class swapping {

  public int trade(int []a, int b){ //says theres a missing return statement 
    int temp=0;
    for (int n = 1; n < b; n++) {
      for (int m = 0; m < b - 1; m++) {
        if (a[m] > a[m] + 1) { 
          temp = a[m];
          a[m] = a[m+1];
          a[m+1] = temp;
          return a[m]; 
        }
      }
    }
    return 0;
  }
}

Now it'll run well.

nanosani 20 Technize.net addict Team Colleague

Ahhh! I don know what to say in this situation .... but I tell you I have always seen you smiling in your posts n ofcourse in your pic n your avatar .... Its really sad seeing you sad ... its its its really sad ... I can feal my heart beating for you ..
Just a wish that your dad rests in heavens .... and may God give you the courage to face all the difficulties in your life ... n a hope you get no difficult situations in your life to face ...

nanosani 20 Technize.net addict Team Colleague

Try to read your book fren .. you'll find your answers in the first chapter.

nanosani 20 Technize.net addict Team Colleague

I think these are not project questions. You can find the answers to these questions in you java book.

Anywayz ... here are some hints.
Parameters are values that are passed to functions for the function to use those values. e.g, public void function(int a){} ... here int a is a parameter.
You can get yourself going by reading further about passing parameters by value, and passing by reference.

No we dont always need to store the value returned by a function but it is not usually a good programming practice.

array passing is done like this. public void function( int []a){}

alc6379 commented: You're a great help in the Java forum! --alc6379 +3
nanosani 20 Technize.net addict Team Colleague

which version of JBuilder are you using ? I am using JBuilder 7 and I am hoping to get JBuilder 9.

nanosani 20 Technize.net addict Team Colleague

Thanks ... I dont have the latest SDK ... I'll download it now.

nanosani 20 Technize.net addict Team Colleague

No one did solve my problem ... I solved it myself LOL.

I created another file named "filename.for" and saved the font, background, foreground and font size info in it ... and when opening a file looking for that filename.for ... if found ... apply everything likewise ... if the file is not found ... simply write the contents of the file as is.

nanosani 20 Technize.net addict Team Colleague

if(age < 18 && > 65){
Replace this with :
if(age > 18 && < 65){
You got the wrong arrows ... it says age less than 18 and greater than 65 is accepted ... LOL

nanosani 20 Technize.net addict Team Colleague

So many programming language forums and no contest on programming :cheesy: ... I suggest programming contest in specific languages .... ( JAVA my language :p )

nanosani 20 Technize.net addict Team Colleague

Can anyone suggest a contest or it is all up to you to handle it ?

nanosani 20 Technize.net addict Team Colleague

how to make my frame as full screen. Is there any API that implements this in java.

nanosani 20 Technize.net addict Team Colleague

I thought I'd better convey what I am thinking right now .... I think the site should have ... in addition to tutorials, snippets and book reviews .... a solving challenge type of a thing ... in which Questions(whole problems ... not just code help) should be posted to be solved by the community ....

nanosani 20 Technize.net addict Team Colleague

Didnt you see the announcement ....
" We only give homework help to those who show effort"

So please atleast start doing your work ... and post again if you have some trouble building some specific component.

nanosani 20 Technize.net addict Team Colleague

if(reply == "JAVA"){
make this code as :

if(reply.equals("JAVA");

now it'll work properly. Strings are not compared by ==.

nanosani 20 Technize.net addict Team Colleague

static final int ROW_SIZE = 10;
static final int COL_SIZE;

You are declaring ROW_SIZE AND COL_SIZE as final ....
when a variable is declared as final ... its value cant be changed at any stage of the program. And you are changing the values of both .. so it wont compile.

nanosani 20 Technize.net addict Team Colleague

The easiest way to interact with the hardware using windows is using the windows APIs. Read about JNI (which will be used to implement the winAPI) ... and read about winAPI in msdn library.

nanosani 20 Technize.net addict Team Colleague

I'll be telling you a collection of tips to improve your system performance ... (it did improve my system performance to about 200 %)

1)CHANGING THE CACHE SIZE:

Go to start --> Run --> System.ini

Write these to the system.ini file
[vcache]
MaxFileCache=8192
MinFileCache=2048
ChunkSize=512

These cache settings are for power users with 128 mb of ram ... if you have more ram ... you can increase the settings to double also.

2)Right click My Computer --> Advanced --> Performance options
Select optimize performance for Applications
And change the virtual memory size to double your RAM size ... and if you need more virtual memory ... make small amount of virtual memory on different drives. One whole piece of virtual memory slows down performance.

3)Go to Control panel --> System --> Device Manager. Go to disk drives and click on your hard drive, go to properties and click the settings tab and then check the DMA box. Do this for all your hard drives. This will improve hard drive io.

4) CHANGING THE REFRESH RATE:
Right Click on desktop --> Settings --> Advanced --> Monitor
Change the refresh rate to maximum ... greater refresh rates provide with clear screen and less eyestrain.

5) INCREASING THE MODEM SPEED:
Right Click My Computer --> Properties --> Device Manager --> Ports(if you cant find you modem port .. then go directly to modem)
Go to …

dlh6213 commented: Looks like good advice! -- dlh +1
nanosani 20 Technize.net addict Team Colleague

schizophrenic --> headache

nanosani 20 Technize.net addict Team Colleague

cscgal Got me :rolleyes: :cheesy:

that means I should flood the forum with questions to get 2 out of 100. LOL :mrgreen: . Anywayz ... you say and I be patient. :cool:

nanosani 20 Technize.net addict Team Colleague

What if I dont get reply to my questions ..... I didnt get any replies of any of my threads yet :!: :!: :!: :mrgreen:

nanosani 20 Technize.net addict Team Colleague

Supra !
Yes ofcourse I love to program in java ... when I started programming in java I forgot about all other languages ....
I think your project choice is right ... but remember that if you are to do a big project ... then making a windows notepad like thing wont work for you .... it'll be very simple for you (after reading some java io). I have also made a notepad ... and I had some problems ... I posted them on ... and yet no replies :p .
If you wanna get the raw code of the text Editor ... then mail me at nanosani@yahoo.co.uk

nanosani 20 Technize.net addict Team Colleague

just add a timer at the start of the program execution .... there are two types of timers .... one for gui and one is general
general:
java.util.Timer
Timer t = new Timer();

gui:
javax.swing.*
Timer t = new Timer(ActionListener, delay);

Read more about the timers in the java API.

nanosani 20 Technize.net addict Team Colleague

I took this code from a thread I dont remember ... so its not on my credit.... anywayz it'll be helpful to you ...

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class NoughtsAndCrosses extends JPanel implements ActionListener
{
    private boolean gameOver; // to keep track of the game status
    private String player; // to keep track of the current player
    private Panel board = new Panel(); // to hold the nine cells
    private Button [][]cell= new Button [3][3]; // the cells
    // these next two labels provide a border around the cells
    private Label blankL = new Label("   ");
    private Label blankR = new Label("   ");
    // the next two labels are centre alligned
    private Label error = new Label ("",1);
    private Label info = new Label ("player X to start", 1);

    // the constructor
    public NoughtsAndCrosses()
    {
      
      setBackground(Color.yellow);
      gameOver = false;
      player = "X"; // player X to start the game
      board.setLayout(new GridLayout(3,3)); // discussed later
      // creates and adds nine buttons to the board
      for (int i = 0; i<3; i++)
      {
        for (int j=0; j<3;j++)
        {
          cell[i][j] = new Button();
          cell[i][j].addActionListener(this);
          board.add(cell[i][j]);
        }
       }
       // positions the items on the screen
       setLayout(new BorderLayout());
       add("Center",board);
       add ("West", blankL);
       add("East", blankR);
       add("North", info);
       add("South",error);
    }

    public void actionPerformed(ActionEvent e)
    {
       if (!gameOver)// process mouse click only if game is not over
       {
        for (int i = 0; i<3; i++)
        {
          for (int j=0; j<3;j++)
          {
            if (e.getSource()== cell[i][j])
            {
              processEvent(i,j); // call worker method to process event
            } …
nanosani 20 Technize.net addict Team Colleague
nanosani 20 Technize.net addict Team Colleague

I wanna ask .... if I want to save the content of JEditorPane or JTextPane in a file without losing the formatting ... how should I do it ....
If I save it to a string ... all the formatting is lost .

nanosani 20 Technize.net addict Team Colleague

knows that well

nanosani 20 Technize.net addict Team Colleague

sex --> stunned

nanosani 20 Technize.net addict Team Colleague

which specific hardware do you want to know ....

nanosani 20 Technize.net addict Team Colleague

Lets give it a try :

Button.addActionListener( new java.awt.event.ActionListener(){
public void actionPerformed(ActionEvent e){

//convert fields into integers
int a = Integer.ParseInt(TextField1);
int b = Integer.ParseInt(TextField2);
int c = Integer.ParseInt(TextField3);
int d = Integer.ParseInt(TextField4);

//adding all numbers
int e = a + b + c + d;

//displaying the result in TextField5
TextField.setText(""+e);
}
});

This sample code will help you .... build the app now.

nanosani 20 Technize.net addict Team Colleague

try using Internet Download Accelerator or Lightening Download. I havnt found any resume qualities in the IE.

nanosani 20 Technize.net addict Team Colleague

It'll be logcally constructed .... you have to design an algorithm ..... checking three things ..... 1 - Teacher Conflict 2 - subjject Conflict 3 - Time Conflict.