JSF :: 1.2 - Add Focus To Certain Element On Page Using Custom Component

Apr 28, 2014

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.

Example:

<h:inputText id="myFirstTextField" value="#{bean.someText}">
<o:focus/>
</h:inputText>

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.

Migrating is evidently not an option.

I'm using Seam 2.1.2 and richfaces 3.3.4

View Replies


ADVERTISEMENT

How To Focus At One Component

Feb 23, 2014

I want to focus at a JTextField, how to do that? Can setfocusable work?

View Replies View Related

JSF :: Focus The First Element?

Apr 4, 2015

I'm creating a simple login screen and I need to focus on the first field "login" after I click a submit button, so when the page return. I tryed using JS :

window.onload = function() {document.forms[0].elements[0].focus();};

but it not worked. I need a solution if possible without using JS. I'm using raw JSF implementation without PrimeFaces or anything else like this.

View Replies View Related

Working With Custom JList Component In Java

Aug 21, 2014

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;

[Code] ....

View Replies View Related

Custom Jtable Cell Editor Throwing Illegal Component State Exception

Jul 10, 2014

I've come across an interesting problem when using a Jcombobox as a custom cell editor(and renderer) in a jtable. I was hoping to add a keybinding in order to display the dropdown of the combobox instead of having to click on it however, when I make a call to showPopup() I get:

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location Which is strange as my jtable is visible and the editor/renderer seems to be working fine.

Here's the cell editor + renderer I'm using:

class MyComboBoxRenderer extends JComboBox implements TableCellRenderer {
public MyComboBoxRenderer(String[] items) {
super(items);
} public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
if (isSelected) {
setForeground(table.getSelectionForeground());

[code]....

View Replies View Related

JSF :: Custom Page That Can Handle Get And Post Request Directly

Jun 24, 2014

Having with LSL and JSF working together? The only thing I have gotten to work with LSL is PHP, and I know I could get JSP working with it with a little research. However, I rather not mix them on my server.

The only requirement for LSL to work with it is there needs be a custom page that can handle get and post request directly. I have not done this with JSF yet so I'm wondering how that would look.

View Replies View Related

Print Custom Invoice Of Page Size Using Jasper Report Or IText For Java

Jul 4, 2014

I want to print data on invoice receipt size of 20.5 x 14 cm(hard copy). In which I try to put text at some absolute location. I tried iText first. In that I try to set page size by following code. here what is unite used in bracket of rectangle?
 
Document document = new Document(new Rectangle(552,377));
 PdfWriter.getInstance(document, new FileOutputStream("report.pdf"));
document.open();
...
...
...
document.close();

Second I tried Jasper report. In that I set page size to 20.5 x 14 cm. But how can I take value from my java application's textfield and put it in to some absolute location in iReport.As I know jasper report take value from database but how can I take value from java application's textfiled?

I am more familiar with iText. How can I print custom invoice using iText or Jasper Report.I am developing java application using netbeans.

View Replies View Related

Swing/AWT/SWT :: Panel Doesn't Refresh When New Component Added If Smaller Than Largest Visible Component

Jan 26, 2014

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?

View Replies View Related

Add Element As Third Element Of Stack Without Changing Rankings

Jun 1, 2014

I want to run a program to add an element as the third element of stack without changing rankings, I am trying to use two stack and I don't know how to push the top of first stack in the second: push(top(); this line

public void ADD(int element,int i ){
if(isEmpty(true)){
push(element);}
else{ makeNull();
while((i<=3) && (isEmpty(false))){
push(top();
}

View Replies View Related

Storing Custom Object In SQLite DB / Serializing Custom Object?

Jul 13, 2014

I have this arraylist off a custom object that looks like this witch also contains a list off custom objects

package holders;
import java.util.ArrayList;
public class ManufacturingJobHolder {
private String name;

[code]....

View Replies View Related

JSP :: Extracting Information About Previous Page From Where Current Page Came

Jan 31, 2015

I have to implement a system where I have to do almost same processing on a jsp page. The slight differences on the present page is based on whether the current page came from page 1 or page 2. So how can I do this?

View Replies View Related

JSF :: XHTML Page - Access To Content Of Dynamic Page?

Jan 15, 2014

I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.

<edges>
<ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar">
<edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}"
weight="#{edge.weight}">

[Code] ....

When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

<edges>
</edges>

How can i access to content of this xhtml page and save it on disk?

View Replies View Related

Who Keeps Track Of Which JComponent Has Focus

Aug 31, 2014

I have two JFrames: frame1 and frame2. frame2 currently has focus, and I want to determine which component of frame1 would have focus if I were to switch focus to frame1, hopefully without actually temporarily changing focus.

Is it the KeyboardFocusManager who keeps track of which element in each frame has focus? Or does each container itself keep track? How does Java figure out which element in a frame gets focus when I switch to that window?

View Replies View Related

Swing/AWT/SWT :: How To Customize Focus Traversal Through Tab Key

Apr 29, 2014

I'm facing a problem in controlling the focus traversal mechanism inside a jframe...as i want the focus to travel from top to bottom by pressing tab key regularly , but it travels left to right and then top to bottom through the textfields... The form looks like
textfield1 textfield4

textfield2 textfield5

textfield3

The focus travels from 1 to 4 , 2 to 5 and then rests at 3. but i want it to be like from 1 to 2 to 3 and then 4 and 5....

View Replies View Related

Java Loses Focus When Printing

Aug 1, 2014

I am working on a Java program to monitor meal consumption by members of an organization. They swipe their ID cards, enter PIN, and number of meals they want. System knows if dining room is open and what meal based on time. The system then prints out a receipt on an Epson TM-T88IV receipt printer.

The system is running in console mode. My problem is that when the system prints, a Notepad window pops up for milliseconds and then the Java program loses focus. The screen reverts back to Windows home screen. I'm using Windows XP, SP3 and the latest Java build.

How to prevent the loss of focus?

View Replies View Related

How To Get Keyboard Input Without Focus On The Frame

Jan 29, 2015

so i'm working in a chat program and i'm trying to make it so that you are able to open another tab yet still be able to chat.

right now the client that the user download uses the keyadapter to get the keyboard input, but whenever the user un-focus the chat window, the keyadapter no longer gets the keyboard input.so is there another way i can get the keyboard input? so it doesn't matter what window you are focused on, you get the keyboard input either way?

View Replies View Related

JTextField Cannot Be Edited After Requesting Focus

Oct 27, 2014

Im trying to embed swt browser in swing , the problem that I have is that i cant change the value of JTextField even when i request focus ,when i try to give input the input goes in the browser's page bar..

public static void main(String[] args) {
final SwtBrowserCanvas browserCanvas = new SwtBrowserCanvas();
final JTextField textField = new JTextField(15);

[Code]....

View Replies View Related

JSP :: How To Open Page Inside Another Page

Apr 1, 2015

I have two jsp page one is demo1.jsp and other is demo2.jsp on a click of a particular link on demo1.jsp I want to opwn demo2.jsp inside demo1.jsp without changing layout of demo1.jsp..I tried to use <jsp;include but that doesn't work for me.But how to do this simply on a single link click on a big page?

View Replies View Related

Swing/AWT/SWT :: How To Change Jbutton Color While It Is In Focus

Jan 27, 2013

refer to this code~

import java.awt.GridLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.Color;
import javax.swing.JButton;

[Code] ....

View Replies View Related

Swing/AWT/SWT :: Have JDialog Dispose When Focus Is Lost?

Jan 21, 2014

This code will not dismiss the MemoryDateDialog when it loses focus, while it is what it is intended to do.

btnMemoryReason.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
List<MemoryDates> lMemoryDates = db.getMemoryDates(custID);
final MemoryDateDialog mdd = new MemoryDateDialog(lMemoryDates);

[URL] .....

View Replies View Related

Change Frame And Focus In Card Layout

Feb 18, 2014

I'm nearing the final development stages of my first game, but have run into a problem. I've constructed 4 different levels and allow the user to select the level they want to play from a central JPanel in a Card Layout system. My problem is that once a level is completed, I can't switch the JPanel which is displayed to start the next level, since I don't know how to access the original JPanel which acts as a driver for the other panels.

MainFrame.java

Java Code:

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Font;

[Code] ....

View Replies View Related

Cannot Add Another Component From Class

Apr 12, 2014

I cannot add the component from this class:

Java Code:

package TestVersion;
import java.awt.Color;
import java.awt.Graphics;
public class matWood {
private int woodX = 250;
private int woodY = 100;

[Code] ....

The error is at Java Code:

frame.add(matWood); mh_sh_highlight_all('java');

And this is what it says:

The method add(Component) in the type Container is not applicable for the arguments (matWood)

View Replies View Related

Cannot Add Second Component To Frame?

Apr 13, 2014

I can't seem to add second component to frame what this class creates:

package TestVersion;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JFrame;
import TestVersion.CKeyListener;
import TestVersion.GameWorld;
import TestVersion.MatWood;
public class MYCoreWorld {

[Code] .....

View Replies View Related

GUI Compass Component

Nov 16, 2014

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.

View Replies View Related

Sum Up Component Of Array?

Oct 15, 2014

How can ı sum up component of an array?

View Replies View Related

Swing/AWT/SWT :: How To Use Container Order Focus Traversal Policy

Feb 1, 2014

the focus traversal policy (hereafter "tab order") in forms and panels doesn't follow the order in which controls were inserted into the container, but is derived from the position of the components on the form or panel. This is very neat (and probably allows sloppy coders and GUI builders to exist without actually ever thinking about the tab order), except when it isn't. As when you actually want to specify a different component order, for example.

In the following example, I've created a form with two columns of buttons. I want the tab order to go through the first column of buttons, followed by second column of buttons (ie. a column-by-column schema). The default tab order is row-by-row, however, and can be obtained for reference by commenting out the setupFocus() call in the constructor.

I had hoped that the ContainerOrderFocusTraversalPolicy would do the job, but there is a couple of problems (which I've addressed in the setupFocus() method). Firstly, the container itself is part of the focus chain. This at least is easily remediable by calling setFocusable(false), but I don't have to do that with the initial focus traversal policy, so I wonder why I have to do it with this one. The other problem is more pressing, though - the ContainerOrderFocusTraversalPolicy lets me (un)hapilly tab through JLabels. Again, I've fixed this, but the initial policy knows all by itself that it's not a good idea to focus a JLabel. Moreover, I'm afraid there might be other components that do not receive focus with the original policy, but ContainerOrderFocusTraversalPolicy might plod though them.

isn't there some focus traversal policy implementation that I could just set and it would tab through exactly the same components as the original policy, except it would order them according to their order in the container?

Code:

package test;
import java.awt.Component;
import java.awt.ContainerOrderFocusTraversalPolicy;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

[code]...

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved