I have a JPanel that's using a simple GridBagLayout.
JPanel panel = new JPanel(); GridBagLayout qPanelLayout = new GridBagLayout(); qPanelLayout.columnWidths = new int[] { 0 }; qPanelLayout.rowHeights = new int[] { 0 }; qPanelLayout.columnWeights = new double[] { Double.MIN_VALUE }; qPanelLayout.rowWeights = new double[] { 0.0 }; panel.setLayout(qPanelLayout); componentCount = 0;
Based on user input I am adding sub-panels to the panel. These sub-panels may vary in height. They take up the full width of the Panel.
public void add(Component comp) { GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(2,2,2,2); gbc.gridx = 0; gbc.gridy = componentCount++; panel.add(comp, gbc_questionPane1); }
The odd behaviour I'm seeing is that if the height of the new sub-panel I'm adding is less than the height of the largest sub-panel currently displayed then the main panel does not repaint. If its height is equal or greater then the Panel does repaint, and any sub-panels that were added but not visible before are now painted. What have I missed?
I've been looking through the Java API for a component similar to the direction selector compass in google earth (the one that acts like a circular scroll bar) to no avail. Any existing component before breaking down to creating the component myself.
In a java application project called mycomposites, i created xhtml with a composite component interface and implementation in mycomposites/ src/ main/resources/testcomponents/myComponent.xhtml...Then I created a new project testmycomposites added mycomposites as dependency. Here is the source of an xhtml that should use myComponent:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
[code]...
However running project, I get error:<tp:myComponent> Tag Library supports namespace: http://java.sun.com/jsf/composite/testcomponents, but no tag was defined for name: myComponent
If i put the same custom component in resources/testcomponents folder of the same project everything works fine.I can't find any example in wich custom composite components are located in a dependency.
I have created a text file that contains a small list of toy names and prices, like:
Barbie, 12.95 Lego, 15.99 Hot Wheels, 5.00 Power Rangers, 6.49
And what I would like is my application to read the contents of the file and store the toy names in a list component. And then I want to be able to select a toy name from the list and add it to a shopping cart that is a list component as well. I want to the application to have menu items and buttons to allow me to remove items from the shopping cart, clear the shopping cart of all selections, and check out.
When I check out, the application should calculate and display the subtotal of all the toy names in the shopping cart, the sales tax (which can just be 8 percent of the subtotal), and the total.
How to create this simple application example I've just made up, and I'm going to add and use this example to create a bigger application myself.
I am developing an application where blind person can interact with computer i have completed the part where computer responds as per command given by user.The part where i am stuck is i want to give voice feedback as user moves the curser for example if mouse is on d drive then user should get feedback that its d drive....i want to do it for whole windows ...
I have to create a new custom tag "imageLabeable" as a div contains a GraphicImage and an OutputLabel (primefaces).
Since I want to make it reusable as much as possible, I tried to write, in cc:interface section, all GraphicImage attributes (id, value, binding etc) and some new (GraphicImage is the main component among the two). But after that I have must associate GraphicImage attributes with the attributes created in cc:interface:
As you can see, if I have a lot of attributes I have to write a lot of association. Furthermore, if I see html rendered code with Firebug or similar, I see all of these associations.
Can I inherit these attributes automatically? Or associate it in easier way?
I heard one of the senior architects in my company before tell me to treat component distribution as a last resort. So if EJB were created for such, why were they created if component distribution is not encouraged anyway? just got confused here. I remembered this because I am currently in a dilemma of whether to redesign an app having performance problems. Options are either create EJBs for it and put them in another server or purchase another server to have a load balanced setup.
I have created a text file that contains a small list of toy names and prices, like:
Barbie, 12.95 Lego, 15.99 Hot Wheels, 5.00 Power Rangers, 6.49
And what I would like is my application to read the contents of the file and store the toy names in a list component. And then I want to be able to select a toy name from the list and add it to a shopping cart that is a list component as well. I want to the application to have menu items and buttons to allow me to remove items from the shopping cart, clear the shopping cart of all selections, and check out.
When I check out, the application should calculate and display the subtotal of all the toy names in the shopping cart, the sales tax (which can just be 8 percent of the subtotal), and the total. create this simple application example I've just made up, and I'm going to add and use this example to create a bigger application myself.
I am using the Javafx 8 Date Picker. Its works fine. I have defined a stylesheet for my application and in that style sheet i have a style for Button. I apply this style to the every scene. Now my question is: When I use the datepicker and I click on the calendar icon, the datepicker popup appears and the left and right arrows adjacent to month and year fields in the seems to pick the style of the button class from style sheet defined in my application., Is there a way to avert this and tell datepicker to use default styles and not the styles defined my application.
I tried removing the style at runtime from the scene, but of no use.
Can I add actionListener to a button component without creating a reference to it? Look at my code below:
public void init() { setBackground(Color.red); //Create the layout setLayout(new BorderLayout(20, 5)); //Add buttons add("North", new Button("Red")); add("South", new Button("Yellow")); add("East", new Button("Cyan")); add("West", new Button("Magenta")); add("Center", new Button("White")); }
Or should I just do the usual instance.addActionListener(this) like myButton.addActionListener(this)?
I am trying to use the JList to display a list of students. Now, each student has a first name, last name and course taken. each courses taken by the student has its' own name, level and idNumber. For now, I am just trying to create my own custom JList model for the students. I have the custom model as well as the button event calling it. Unfortunately, when I click the button to display the student info added, the component is NOT fired up!..
I am not sure what I have done wrong regarding creating the component because I can display the information on the console and the list contains everything I have added but just to display it on the component is NOT working. I have broken the codes into sub classes, you can add the classes to the same package or create sub packages to insert individual classes.
The student class
public class Student { private String studentName; private String studentID ; public String getStudentName(){ return studentName;
I am learning Java on my own and I am taking on very small project by myself for fun, and I'm just stuck on this small part of the project. So I have created a text file that contains a small list of toy names and prices, like:
Barbie, 12.95 Lego, 15.99 Hot Wheels, 5.00 Power Rangers, 6.49
And what I would like is my application to read the contents of the file and store the toy names in a list component. And then I want to be able to select a toy name from the list and add it to a shopping cart that is a list component as well. I want to the application to have menu items and buttons to allow me to remove items from the shopping cart, clear the shopping cart of all selections, and check out. When I check out, the application should calculate and display the subtotal of all the toy names in the shopping cart, the sales tax (which can just be 8 percent of the subtotal), and the total.
I have a problem to display a popup with the information of the registered event. I would like the user to hover over a particular event exhibited only the description of the event without having to click on the event to view information. I would like to make an ajax request to that was displayed a popup.
But do not know how to implement jquery and javascript. Well, I am new to programming. My code that generates the schedule is as follows:
In my Bean have methods that make the selection of date and event. Have I configured the option of setEditable to true. Ajax function, jquery or javascript to show the popup containing only observation and event date. And looked at the documentation of primefaces and not found any implementation to solve my problem.
I don't know if this is possible before JSF2.0, but I got a requirement that basically says that I need to be able to add focus to a certain element on the page using a custom JSF 1.2 component.
Currently, I do this with a short jQuery method where you add a class called 'focus' to the inputText component you want focus on. This works perfectly, but I need to also foresee a nested component inside h:inputText to do this.
I had thought about just putting an element with a certain class and using a jQuery selector to get its parent, but then I realized the html input tag does not allow subtags and that couldn't work, so I need something that won't be rendered but will do the job.
The problem is from "perspective" in -webkit-transform. Without it's ok. But with this one, the result is different from a standard browser like chrome or safari.
For example, say I have I BoxLayout with a few JButtons in it. How could I make it such that I could drag a JButton such that it could be in front or behind the others?
I've thought about using ComponentMover and just switching to a null layout right before moving it and switch it back right after like bellow, but I'm not sure how to make it keep the change in order.
import java.awt.LayoutManager; import java.awt.event.MouseEvent; public class LayoutComponentMover extends ComponentMover { private LayoutManager layout;
I am trying to place a number of JLabel and JTextField objects inside a JPanel which has a JScrollPane.
One thing is, that at one time, I have have a certain number of JLabel and JTextField objects which number would cover an area greater than the JPanel's vertical size.
How when I implement the JScrollPane and I run the program, the scroll bars appear, but they don't scroll the pane inside the JPanel, the items are fixed.
Could the problem be because I am using a Null Layout.
Will I have to use one of the standard layouts available, like GridLayout for the JScrollPane scrolling function to work?
My question is related to combo boxes. A combo box in general is a text field with a dropdown list. I would want to know if we can replace hthe dropdown List by an other component, for example a JTable component.