Win a copy of Spring Boot in Practice this week in the Spring forum!

Joao Cunha

Greenhorn
+ Follow
since Jul 12, 2004
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 Joao Cunha

Hi all!

How can I set the ascent value of a font?
I'd Like to have the text height equal to the font size. So, if the font size is 20, I'd like to have the text height equal 20, without any spacing at the top and bottom of the text.

The code to get the ascent of font is:


Thanks a lot for the help!
15 years ago
Hi!

I have implemented a sound player fo midi files and it worked fine on Eclipse. However, at the moment I built my application on a Jar file and tried to execute it from file system, an exception occurred:




This problem happened when I tried to get the sequencer using MidiSystem.getSequencer();
If I get the jar and execute it inside the eclipse, nothing happens. The problem is on executing the jar from the file system.

Any idea?

Thanks!
16 years ago
Have someone faced and solved this problem?
Hi!

I'm developing a swing application and I want to support key accelerators to my menu options. However, I'm facing some problems with it.
My application contains 5 views (JPanel instances) and the menu is on the main view. Depending on the view that is selected, the key accelerator does not work.
And even on the views that it works, if I select a tab (for exemple), the key accelerator does not work.

Is there a code that I can put on each view to guarantee the key accelerator functionality?

Thanks!
16 years ago
Hi!

I've tried to change the xml, but there was no result.
I'm thinking that there is a problem with the version of hbm2java I'm using.
I'm using hibernate 3 with java 5... the code generated by hbm2java is working correctly to relational objects (the generic marker is generated correcly with the '<class>' code), but not with the wrappers (Long, Boolean, String, ...)

Are there a place where I can find the source code of hbm2java?
Or even a description about this library?

Thanks!
Hi!

I've already tried to put string, String, java.lang.String, Text, varchar as type and none of these worked.

I don't know if the problem is in the hibernate synchronizer plugin or on the hbm2java.jar!

What do you sugest?

Thanks!
Hi!

I'm studing about hibernate by the Hibernate 3 tutorial. I also installed the hibernate synchronizer 3.1.1 in my eclipse (3.1.2 with java 1.5) in order to facilitate the code gen.

However I'm facing some problems working with collections and bi-directional links in hibernate_synchronizer (hbm2java).

I set a collection on hbm.xml file according to hibernate 3 tutorial and the code has not been created correctly:
Code:

Then I invoked the "Synchronize Files" command of hibernate synchronizer and the base vo was generated with error:
Code:

The "<null>" should be "<String>"

This problem is happening to any wrapper object. I'd alread tried to lok for the snippets but I don't have a clue.

Thanks!
Hi!

I've implemented a Tree with checkbox nodes, where the check implies that the node content is set on the program model.

If I select or deselect the node directly, the checkbox is checked/unchecked normally.

However, I have a feature that allows the user to add/remove the node content from the program model without the need to check/uncheck the checkbox.

The problem is that if I get the node checkbox and invoke the setSelected method setting true or false, the Tree view is not updated. The node checkbox view is not updated also. Only the model.

How can I update the view in order to have the tree showing the checkbox as check/uncheck correctly?

Thanks!
16 years ago
Hi folks!

I'm developing a web application and there is an html form which contains a table with four columns. At the first column, I put checkboxes which allow the user remove the items specified on the second column. Moreover, each item may contain more than one subitem. So, at the third column I put checkboxes which allow the user remove the subitems specified on the forth column.

The first column checkboxes are named as "removeItem".
The third column checkboxes are names as "removeItem" + index of the item + "SubItem".

If the user check the checkbox of the first column, all subitems checkboxes related with the selected checkbox item must be checked.

The problem is that I don't know how to obtain the checkboxes of the third column when the first column checkbox is checked.

Someonde knows an solution for this problem?

Thanks!
Jo�o Cunha

PS:
I writed an javascript using the document.getElement() method, but it didn't wotk. It follows the code:

function selectItem(itemIndex) {
var items = document.teamForm.removeItem;
var subItems = document.getElementById("removeItem" + itemIndex + "SubItem");
if (items.length > 0) {
if (teamMember[teamMemberIndex].checked) {
checkAll(teamMemberRoles);
}
else {
clearAll(teamMemberRoles);
}
}
else {
if (teamMember.checked) {
checkAll(teamMemberRoles);
}
else {
clearAll(teamMemberRoles);
}
}
}

The methods checkAll and clearAll check and uncheck, respectively, all the checkboxes from a list
Hi folks!

I have an Java Application that communicates with a servlet by the ObjectInput and ObjectOutput Streams.
I made it work to send and receive data.
The problem is that when I have to send an object to servlet and to receive an object from servlet, my application does two diferent requests to this servlet.
It follows the code:
{
// send data to the servlet
OutputStream outstream = con.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(outstream);
oos.writeObject(obj);
oos.flush();

// receive data from servlet
InputStream instr = con.getInputStream();
ObjectInputStream inputFromServlet = new ObjectInputStream(instr);
Object result = inputFromServlet.readObject();
inputFromServlet.close();

oos.close();
instr.close();
return result;
}

How can I change it to make only one request to servlet, sending and receiving an object from it.

Thanks!
Jo�o Cunha
17 years ago
Initially I have a time on an specif TimeZone:

> Calendar c = Calendar.getInstance();
> c.setTime(date);
> System.out.println(c.getTime());

I want to have this time on GMT-00:00 time zone.
I tried this, but it didn't work:

>c.setTimeZone(TimeZone.getTimeZone("GMT-00:00"));
>System.out.println(c.getTime());
17 years ago
Hi folks!

I want to convert a Date from an specific TimeZone to GMT-00:00 timezone
I already tried to set a Calendar with the date and set the Time Zone but it didn't work...

Any idea?
Thanks!
17 years ago
Hi Folks!

I am looking for some sample codes to add nodes into JTree, where
the nodes could be "JCheckbox with Label" or "Label only". When clicking
on a button, only the nodes with the check in the JCheckbox are
printed.

I created my own cell renderer, then getCellRendererComponent is return JCheckBox on the node that the check box would appear, otherwise return normal JLabel.
It worked but the node is not checkable...
The other problem that I faced is that the icons of the node (like folder file) that comes in the JTree, by default, is not appearing anymore. It's appearing only the check-boxes...

the result should appear like that of eclipse import file system tree, for example...

Thanks for the help
17 years ago
With the Locale, it worked fine!

Thanks!
17 years ago
I tried to create a SimpleDateFormat as follows:
SimpleDateFormat s = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
s.parse("Fri Sep 10 12:33:38 2004");

But it still throw Unparseable Date Exception.
17 years ago