Biliang Zhou

Ranch Hand
+ Follow
since Jun 28, 2006
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 Biliang Zhou

Hi,

I used to have doubts on this question, but now I've come clear.

Defining "confidentiality" as "Confidentiality means the property that data or information is not made available or disclosed to unauthorized persons or processes" is acceptable, if we are talking about it as a general item.

See this link for the traditional definition:
http://www.bricker.com/legalservices/practice/hcare/hipaa/164.304.asp

But when we put it into the context of J2EE, confidentiality actually means the encryption of the data transmitted. Beyond the general definition that "the data should not be made available to others", confidentiality in J2EE means "even if others see it, they won't understand what is being sent because we encrypt our data".

Hope this helps...
I have been using Tomcat for sometime, and is just starting to learn how to use weblogic...

I created a very simple WAR file, containing a few class files and webpages:

--form.html
--WEB-INF
----- web.xml
----- classes
----- lib

When deployed on Tomcat, it works fine. Tomcat automatically loads it from the webapps folder and decompressed it into a folder.

Then I used the admin page to deploy it on Weblogic. But after deploying, I could not access the form.html at the test URL. The error reads:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Error 503--Service Unavailable
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.4 503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay may be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

And it's not working even if I restart the server. Thanks for any suggestions...

[ October 24, 2008: Message edited by: Biliang Zhou ]
[ October 24, 2008: Message edited by: Biliang Zhou ]
13 years ago
Thank you for your clarification and info, Charles!
Hi guys,

I've got a situation here:

A compiled folder "family" contains FATHER.class, FATHER$1.class, MOTHER.class, MOTHER$1.class, SON.class, SON$1.class, DAUGHTER.class, DAUGHTER$1.class. I want to select the class files having to do with Father and Mother, and jar them up into parents.jar; and select the class files having to do with the children, and jar them up into children.jar. How do I finish this task?

I know it should be something like:

<jar jarfile="${build.lib}"/parents.jar
basedir="family">
</jar>

But I'm not sure whether to use include or exclude here.

Thank you for help!
15 years ago
Hi all,

I often wondered whether Swing offers icons (like right triangle, left triangle, upward triangle, downward triangle, squares, and etc.) with their package. Can pros here offer an answer?

If the answer is no, where should I be looking for icons to use in my Java applications? There should have already been a set of such standard icons, like open folder, save, zoom in/out, copy, cut, this kind of things.

Thanks in advance!

kmyc
[ February 27, 2007: Message edited by: Biliang Zhou ]
15 years ago
Sorry I wasn't making myself very clear. What I want is an uneditable JComboBox with a pulldown menu populated by JCheckBoxes. These JCheckBoxes can be multi-selected.

I have figured out how to do this by searching online, and here is an adapted and quoted example:

Note: the key part is one of the methods in the class CheckComboBox: setPopupVisible(boolean flag). It must be overridden to empty, because the default setPopupVisible(boolean flag) will close the pulldown list each time you make a selection with the JCheckBoxes.

****************************************************
CAUTION: freakingly-low quality code
****************************************************



****************************************************
END: freakingly-low quality code
****************************************************
[ February 26, 2007: Message edited by: Biliang Zhou ]
15 years ago
Hi ranchers,

A cellRenderer question:

I have three checkBoxes: labelled Monday, Tuesday, and Wednesday, to be used to render one JComboBox. When the JComboBox is clicked, these three checkBoxes should appear in the pull down menu, and they should be allowed to be multi-selected.

I had a question on how to use JCheckBox as CellRenderer in JList before,

https://coderanch.com/t/344173/GUI/java/JCheckBox-as-CellRenderer-JList

mainly on how to make the CheckBoxes selectable in the List. This problem is solved by using a MouseListener to locate the item being checked.

Now I face a similar but different situation: use JCheckBox as CellRenderer in JComboBox. A JComboBox does not have method like

JList.locationToIndex(e.getPoint());

Thus I cannot locate which items is being checked. This confuses me...



Thanks in advance!
15 years ago
I see the reason why:

The JList needs a MouseListener to handle the checking and unchecking of the checkboxes. That's what is missing in my code. I thought so long as JCheckBoxes are used as the ListCellRenderer they are ready to behave like JCheckBoxes standing alone, and that's not how ListCellRenderer works...

Thank you, Michael!
15 years ago
Hi, I am trying to use JCheckBox as CellRenderer in JList. All go well, and the JCheckBoxes show up in the JList, but I cannot select or unselect these JCheckBoxes. They just don't respond to any mouse or keyboard action...

Here's the source code:

Thank you for looking into this issue!

################################################################

import java.awt.Component;

import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;

public class TestRenderer extends JPanel{

JList list;
Integer integerArray[] = new Integer[10];

public TestRenderer()
{
super();

list = new JList(integerArray);
ComboBoxRenderer renderer= new ComboBoxRenderer();
list.setCellRenderer(renderer);

this.add(list);
}

class ComboBoxRenderer extends JCheckBox implements ListCellRenderer {

public ComboBoxRenderer() {
setOpaque(true);
setHorizontalAlignment(LEADING);
setVerticalAlignment(CENTER);

for(int i = 0; i < 10; i ++)
{
integerArray[i] = new Integer(i);
}
}

public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
//Get the selected index. (The index param isn't
//always valid, so just use the value.)
int selectedIndex = ((Integer)value).intValue();

return new JCheckBox("Test: " + selectedIndex);
}
}

private static void createAndShowGUI() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent newContentPane = new TestRenderer();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});

}

}

################################################################
15 years ago
Thank you, Michael!

Now I can use the recursive algorithm you showed me yesterday to traverse through all the comboboxes and give them different background colors.

And the GradientPaint example is just easy to follow - basically we can use the GradientPaint(x1,y1,Color.blue,x2,y2,Color.white,true) to generate color patterns. It all depends the setting of the coordinates how the color pattern is going to "gradiate".

15 years ago
Nice Friday, guys (a little chilly though...).

I have successfully created a custom renderer for a JComboBox (to change the background color of the pull-down menu, so this color agrees with the background color of the JPanel that is holding the JComboBox, which has been changed to light blue).

But I still have two problems:

First, the combobox lost the mouseover effect - the default renderer works like if you bring up the pulldown menu, and mouseover any item, that item will be highlighted. With my custom renderer, this effect is gone...

Second, is it possible to create a gradient effect on the JComboBox? Like the up-to-down or left-to-right gradient. I wonder whether I need a different look and feel scheme to achieve this...


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
package test;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.plaf.basic.BasicComboBoxRenderer;

public class TestCustomRenderer extends JPanel{

JComboBox comboBox;

public TestCustomRenderer()
{
super(new BorderLayout());
this.setPreferredSize(new Dimension(200, 100));
this.add(get_comboBox(), BorderLayout.SOUTH);
this.setBackground(new Color(153, 204, 255));
}

private JComboBox get_comboBox()
{
comboBox = new JComboBox();
comboBox.addItem("Planning");
comboBox.addItem("Testing");
comboBox.setBackground(new Color(153, 204, 255));
ComboBoxRenderer renderer = new ComboBoxRenderer();
comboBox.setPreferredSize(new Dimension(80, 25));
comboBox.setRenderer(renderer);
return comboBox;
}

private static void createAndShowGUI()
{
JFrame frame = new JFrame("TestCustomRenderer");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JComponent newContentPane = new TestCustomRenderer();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);

frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}

class ComboBoxRenderer extends BasicComboBoxRenderer
{
public ComboBoxRenderer() {
super();
setOpaque(true);
}

public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
setText(value.toString());
if(cellHasFocus)
{
setText("value");
}
else
{
setBackground(new Color(153, 204, 255));
}
return this;
}
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[ November 03, 2006: Message edited by: Biliang Zhou ]
15 years ago
Man, you are really the problem-cracker!!!

And I added several lines so that I can filter components with a given property:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if(comp[x] instanceof JButton &&((JButton)comp[x]).getText().equals("OK"))

{comp[x].setBackground(oKButtonColor);}

if(comp[x] instanceof JButton &&((JButton)comp[x]).getText().equals("Cancel"))

{comp[x].setBackground(cancelButtonColor);}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I used short circuit "&&" so that if the component is not a JButton, the type casting won't take place.

Now I have been able to set a background color to the whole GUI, while setting specific colors to certain components.

Thank you!
[ November 02, 2006: Message edited by: Biliang Zhou ]
15 years ago
This one is really tricky.

If I generate a dialog from JOptionPane, can I change the background color of this dialog? I wonder whether this should be done on the JOptionPane or on the dialog after it is generated. Have tried but didn't get the expected result.

What's even more tricky is, I wonder if it is possible to change the color of the buttons on that dialog -- I mean the default button "OK" or any customized buttons. Since we get the button for free, how can we even get a reference to it...

Would anybody advise on this issue? Many thanks.
15 years ago