basia fish

Greenhorn
+ Follow
since Aug 04, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by basia fish

hi all
what books and other materials would you recomend to help to develop the application and pass the developer exam.
thanks
hi

content of
myproperty.properties file

directory = c:\ddd\
subdirectories = df,d,g

how do i read the file displaying whole directory
Properties property = new Properties();
FileInputStream inputFile = null;
try{
inputFile = new FileInputStream("directoryProperties.properties");
property.load(inputFile);
}catch (IOException e){}

String s = property.getProperty("directory"); - this returns directory=c dd

thanks a lot
19 years ago
thanks a lot it really helped
one more question
if i want to call the function func and pass the string directory

func("c:\aa\bb") - this gives me an error
what is the proper way of doing that
thanks
19 years ago
hi

i am trying to create a function that takes as an input a file directory
c:\aaaa\bbb\cc. i pass it as string. - is this right aproach
but then i need to get to the last folder cc and it content put into
an array (cc - containts somr sub folders) Is using tokens to split the the string s right way.
public void func(String s)
{

}


thank you for help
19 years ago
would that be more appropriate

private int arr[];

public void setArr(int bArr[])
{
for (int i=0; i<aArr.length-1; i++)
arr[i] = aArr[i];
}

public int[] getArr()
{
if (arr==null)
arr=new int[10];
return arr;
}


thanks for help
19 years ago
thanks for help

i saw that web too
so the set method is empty then?

thanks
19 years ago
hi

hor do i use accessor and mutator methods with an array
does this looks ok

private int arr[];

public void setArr()
{
arr = new int[1];
}

public int[] getArr()
{
return arr;
}

thanks for any help
basi
19 years ago
hi

how do i use lazy initialization
how would it change code like this

private int array[];

public void setArray()
{
array= new int[10];
}
public int[] getArray)()
{
return array;
}

help really apprecaited
thanks a lot
barb
19 years ago
hi

how do i use lazy initialization
how would it change code like this

private int array[];

public void setArray(int arr[])
{
array=arr;
}
public int[] getArray)()
{
return array;
}

help really apprecaited
thanks a lot
barb
19 years ago
hi
1.
i have
public static final int BOX = 0;
public static final int CIRCLE = 1;
if i want to put the elements into an array do the array have to be
public static final
or it can be private
and then i just write set and get methods to access and update array


2. is it how I use get and set methods?
private StringBuffer m[][];

// set methods
public void setm(int a[][])
{
m = a;
}
public int[][] getm()
{
return m;
}

any help appreciated
thanks
barbara
19 years ago
hi

my gui:
has:
1. toolbar
2. main panel divided into two panels (left and right)

depending on which button in toolbar is presed i would like to display diffrent panels in those two panels

i tried putting those diffrent panels into diffrent layers and then calling diffrent layers according to which button is presed

however it is not really working
i am posting my simplified code

any help would be appreciated
if there is better way to implement it please help

bbarbara okupna

public class mainClass extends JFrame implements ActionListener
{
JLayeredPane layeredPaneLeft;
JFrame frame;
JPanel leftPanelAddEdit;

public void createAndDisplayGui()
{
frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1200,1000);

JPanel leftPanel = new JPanel();
leftPanel.setBorder(BorderFactory.createTitledBorder("sdsdsds"));

JToolBar toolBar = new JToolBar();

toolBar.add(Button("Add New"));

JPanel mainPanel = new JPanel();


leftPanelAddEdit = new JPanel();
leftPanelAddEdit.add(leftPanel);


layeredPaneLeft = new JLayeredPane();
layeredPaneLeft.add(leftPanelAddEdit, 1);

mainPanel.add(layeredPaneLeft);


frame.getContentPane().add(toolBar,BorderLayout.NORTH);
frame.getContentPane().add(layeredPaneLeft,BorderLayout.WEST);

frame.show();


}



public JButton Button( String name)
{
JButton button = new JButton(name);
button.setActionCommand(name);
button.addActionListener(this);
return button;

}

public void actionPerformed(ActionEvent e) {
if ("Add New".equals(e.getActionCommand())) {

layeredPaneLeft.moveToFront(leftPanelAddEdit );

}
}

public static void main(String[] args)
{
mainClass f = new mainClass();
f.mainClassnn();
}
}
19 years ago
hi
if anyone know a website where i can get a sample assignment for the certification
i would really appreciate if could post it
thanks
barbara
hi i was just doing the mock exam by markus green and encountered a question on Swing. Do I have to know that for the exam too.
thanks
barb
import java.awt.*;
public class CompLay extends Frame{
public static void main(String argv[])
{ CompLay cl = new CompLay(); }
CompLay(){
Panel p = new Panel();
p.setBackground(Color.pink);
p.add(new Button("One"));
p.add(new Button("Two"));
p.add(new Button("Three"));
add("South",p);
setLayout(new FlowLayout());
setSize(300,300);
setVisible(true); }}
can anyone suggest a book to study for the exam.
thanks barb