SetMnemonic(int) on JButton not working!
Hi,
I tried the following code on a JButton
JButton eg = new JButton("Cancel");
eg.SetMnemonic(KeyEvent.VK_C);
however nothing get underlined.
I am using 1.4.2_03
Java is using a new "feature" in Windows XP (may also be in Win2K, I'm not sure).
In XP, to get the mnemonics to show all the time, go into Control Panel, then Appearance and Themes, then click the Display label. You are now presented with a Display Properties window. Click the Appearance tab. Now click the Effects button and you'll find a checkbox at the bottom which controls whether mnemonics always show, or only show when you press the Alt key.
Similar Messages
-
Why does my JButton not work?
Hi,
I am programming a Traffic Light, consisting of 3 lights, and a caption describing who's Traffic Light it is. Traffic Lights are to be used inside a bigger program. But as it is, I'm trying out how to program one Traffic Light.
I created a Light object. A TrafficLight object contains 3 of these objects, and a caption. The TrafficLight object is to be used as a button, so the user can push it, after which some magic has to happen, which I still need to develop. The problem I have is the button does not work.
So, the relevant parts of the code. First the main:
public static void main (String [] args) {
JFrame frame = new JFrame();
frame.setBounds(0, 0, 100, 400);
TrafficLight light = new TrafficLight("Caption", "ERR", true);
frame.add(light);
// frame.pack();
frame.setVisible(true);
}Then the TrafficLight object:
public TrafficLight () {
setUp();
private void setUp() {
JComponent component = createComponent();
add(component);
setVisible (true);
private JComponent createComponent () {
JPanel panel = new JPanel(null);
panel.setBounds (xCoordinate, yCoordinate, WIDTH, HEIGHT);
JButton tlsButton = new JButton();
tlsButton.setBounds(xCoordinate, yCoordinate, WIDTH, HEIGHT);
boolean isOn = true;
boolean isNewProblem = true;
tlsButton.setActionCommand(name);
tlsButton.addActionListener(this);
// Create the lights
redLight = new TlsLight (0, 0, Color.RED, isOn, isNewProblem);
tlsButton.add(redLight);
yellowLight = new TlsLight (0, WIDTH, Color.YELLOW, !isOn, isNewProblem);
tlsButton.add(yellowLight);
greenLight = new TlsLight (0, 2 * WIDTH, Color.GREEN, isOn, !isNewProblem);
tlsButton.add(greenLight);
tlsButton.add(customerLabel, Component.CENTER_ALIGNMENTl);
panel.add(tlsButton);
return panel;
}And, finally, the TlsLight object:
public void paint (Graphics graphics) {
setSize(width, width);
int diameter = width - 2 * insets;
// Paint the background (square) based on if the Customer has a new problem or not
if(isNewProblem) {
background = Color.GRAY;
else {
background = Color.BLACK;
graphics.setColor(background);
graphics.fillRect(xPos, yPos, width, height);
// Set color light based on problemStatus
if(isOn) {
graphics.setColor(theColor);
} else {
graphics.setColor(background);
graphics.fillOval(xPos + insets, yPos + insets, diameter, diameter);
// Set the background of the light
graphics.setColor(Color.WHITE);
// Paint the background
graphics.drawOval(xPos + insets, yPos + insets, diameter, diameter);
}When I push the button, nothing happens. Do you know what I need to do to get my prog working?
TIA,
AbelI don't know what goes on in your ActionListener, but I have a feeling that something is missing there.
public TrafficLight () {
setUp();
private void setUp() {
JComponent component = createComponent();
add(component);
setVisible (true);
private JComponent createComponent () {
JPanel panel = new JPanel(null);
panel.setBounds (xCoordinate, yCoordinate, WIDTH, HEIGHT);
JButton tlsButton = new JButton();
tlsButton.setBounds(xCoordinate, yCoordinate, WIDTH, HEIGHT);
boolean isOn = true;
boolean isNewProblem = true;
tlsButton.setActionCommand(name);
//tlsButton.addActionListener(this);
tlsButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
System.out.println("Hello World!"); //Implement with you own stuff....
// Create the lights
redLight = new TlsLight (0, 0, Color.RED, isOn, isNewProblem);
tlsButton.add(redLight);
yellowLight = new TlsLight (0, WIDTH, Color.YELLOW, !isOn, isNewProblem);
tlsButton.add(yellowLight);
greenLight = new TlsLight (0, 2 * WIDTH, Color.GREEN, isOn, !isNewProblem);
tlsButton.add(greenLight);
tlsButton.add(customerLabel, Component.CENTER_ALIGNMENTl);
panel.add(tlsButton);
return panel;
} -
Html code in JButton not working
hi all,
i wrote html code in JButton,but it's not working,it is displaying all the code what i have placed in the html tag.this message is displaying in button.
"<html><STYLE=\"font-family: Dialog; font-size: 12pt\"><center>Current<br>Date</center></STYLE></html"
JButton but1 = new JButton("<html><STYLE=\"font-family: Dialog; font-size: 12pt\"><center>Current<br>Date</center></STYLE></html>");
Thanks in advance
bhaskarwill it work in java 1.2 or not
bhaskar -
Need a little help with a Jbutton not working out the way I planned
The following code is to fulfill an assignment I am working on. The problem I am having is with the btnCalc. For some reason when the button is used, the results I get is from another button. I think the variables are set right for the program to function properly but I am really hung up on this. Do anyone have any suggestions?
import java.awt.*; //Contains classes for creating GUI
import java.awt.event.*; //For listener events
import javax.swing.*; // Imports the Main Swing Package
import javax.swing.event.*;
import javax.swing.text.*; // Positions text box
import java.text.NumberFormat; // For number format such as currency
import java.text.*; // Imports the Main Text Package
import java.util.*; // Utility Package
public class MPC extends JFrame implements ActionListener //Creates Class for MPC
//double dblLoanAmount, dblInterestRate, dblMonthlyPayment;
TextField txtTotalMort;
//JButton fixRates = new JButton("Choose Fixed Rates");
JLabel lblTotalMort = new JLabel("How much is the loan?"); // Label for dblLoanAmount amount
JTextField txtYears = new JTextField(10);
JLabel lblPayment = new JLabel("Your monthly payment is "); // Label for Payment
JTextField txtPayment = new JTextField(10);
JLabel lblYears = new JLabel("How many years?");
// add(lblYears);
JTextField txtYearsInput = new JTextField(10);
//a dd(txtYears);
JLabel lblInterestRate = new JLabel("What is the interest rate?");
//add(lblInterestRate);
JTextField txtInterestRate = new JTextField(10);
//add(txtInterestRate);
//JLabel lblPayment = new JLabel("Your monthly payment is:");
//add(lblPayment);
//JTextField txtPayment = new JTextField(10);
//txtPayment.setEditable(false);
//add(txtPayment);
JButton btnCalc = new JButton("Calculate");
//add(btnCalc);
//btnCalc.addActionListener(this);
JButton year7InterestRateBtn = new JButton("7 years at 5.35%"); // Mortgage Term and Interest Rate
JButton year15InterestRateBtn = new JButton("15 years at 5.50%");
JButton year30InterestRateBtn = new JButton("30 years at 5.75%");
JButton reset = new JButton("Clear All");
JTextArea boxSpace = new JTextArea(100,200); // Morgtage table size
JScrollPane scroll = new JScrollPane(boxSpace); // ScrollPane
public MPC() // Method
super("MPC"); // Frame Title
JMenuBar mb = new JMenuBar(); // Menu Bar
setJMenuBar(mb);
setSize(325, 500); // Frame Size
JPanel pane = new JPanel();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); //Grid box configuration
Container grid = getContentPane();
grid.setLayout(new GridLayout(8,2,8,8)); // Grid Layout
pane.add(grid); // Adds grid
pane.add(scroll); // Adds scrollPane
grid.setBackground(Color.white);
Setting color of text and backgrounds
txtYears.setBackground(Color.white);
txtYears.setForeground(Color.black);
txtYears.setFont(new Font("Arial", Font.PLAIN, 10));
txtPayment.setBackground(Color.white);
txtPayment.setForeground(Color.black);
txtPayment.setFont(new Font("Arial", Font.PLAIN, 10));
boxSpace.setBackground(Color.white);
boxSpace.setForeground(Color.black);
boxSpace.setFont(new Font("Arial", Font.PLAIN, 10));
grid.add(lblYears);
grid.add(txtYearsInput);
grid.add(lblInterestRate);
grid.add (txtInterestRate);
grid.add(lblTotalMort); // Adds the Mortgage Amount Label
grid.add(txtYears); // Adds the Mortgage Amount Text Field
grid.add(lblPayment); // Adds the Payment Label
grid.add(txtPayment); // Adds the Monthly Payment Text Field
txtPayment.setEditable(false); // Disables editing in this Text Field
grid.add(btnCalc);
grid.add(year7InterestRateBtn); // Adds 1st Loan and Rate Button
grid.add(year15InterestRateBtn); // Adds 2nd Loan and Rate Button
grid.add(year30InterestRateBtn); // Adds the Exit Button
grid.add(reset); // Adds the New Calc Button
setContentPane(pane); // Enables the Content Pane
setVisible(true); // Sets JPanel to be Visable
reset.addActionListener(this); // Adds Action Listener to the New Calc Button
txtYearsInput.addActionListener(this);
txtInterestRate.addActionListener(this);
btnCalc.addActionListener(this);
year7InterestRateBtn.addActionListener(this); // Adds Action Listener to the 1st loan Button
year15InterestRateBtn.addActionListener(this); // Adds Action Listener to the 2nd loan Button
year30InterestRateBtn.addActionListener(this); // Adds Action Listener to the 3rd loan Button
txtYears.addActionListener(this); // Adds Action Listener to the Mortgage Amount Text Field
txtPayment.addActionListener(this); // Adds Action Listener to the Monthly payment Text Field
public void actionPerformed(ActionEvent e) // Tests to Verify Which Button is Pressed
Object command = e.getSource(); // Enables command to get data
int intYears = 0; // Declares intYears
double dblLoanAmount, dblInterestRate, interestRate, intRate;
if (command == year7InterestRateBtn) // Activates the 1st Loan Button
intYears = 0; // Sets 1st value of Array
if (command == year15InterestRateBtn) // Activates the 2nd Loan Button
intYears = 1; // Sets 2nd value of Array
if (command == year30InterestRateBtn) // Activates the 3rd Loan Button
intYears = 2; // Sets 3rd value of Array
if (command == btnCalc)
//dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
//interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
//int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
int months = Integer.parseInt(txtYearsInput.getText() )* 12;
dblLoanAmount = 0; // Declares and Initializes dblLoanAmount
dblInterestRate = 0; // Declares and Initializes dblInterestRate
double [][] dblTrmLoanRate = {{7, 5.35}, {15, 5.50}, {30, 5.75},}; // Array Data for Calculation
try
dblLoanAmount = Double.parseDouble(txtYears.getText()); // Gets user input from txtYears Text Field
catch (NumberFormatException nfe) // Checks for correct user input
JOptionPane.showMessageDialog(null, "You must enter a valid number.", "MPC", JOptionPane.INFORMATION_MESSAGE);
return;
interestRate = dblTrmLoanRate [intYears][1];
//dblInterestRate=interestRate;
intRate = (interestRate / 100) / 12; // Calculates Interst Rate
double intYearsMonths = dblTrmLoanRate [intYears] [0]; // Calculates Loan Term in Months
int months = (int)intYearsMonths * 12; // Devides by months
double interestRateMonthly = (intRate / 12); // Devides Rate
double payment = dblLoanAmount * intRate / (1 - (Math.pow(1/(1 + intRate), months))); // Calculates monthly payment
double dblRmnLoan = dblLoanAmount; //Left over balance
double txtPaymentInterest = 0; // Payment
double txtPaymentPrincipal = 0; // Payment of principal
NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.US); // Curreny format
txtPayment.setText(currency.format(payment));
boxSpace.setText("Month\tPrincipal\tInterest\tBalance Left\n");
for (;months > 0 ; months -- )
txtPaymentInterest = (dblRmnLoan * intRate);
txtPaymentPrincipal = (payment - txtPaymentInterest); // Calculates monthly payment
dblRmnLoan = (dblRmnLoan - txtPaymentPrincipal);
boxSpace.setCaret (new DefaultCaret()); // Scroll position
boxSpace.append(String.valueOf(months) + "\t" + // Table data
currency.format(txtPaymentPrincipal) + "\t" +
currency.format(txtPaymentInterest) + "\t" +
currency.format(dblRmnLoan) + "\n");
if(command == reset)
Clears fields
txtYearsInput.setText(null);
txtInterestRate.setText(null);
txtYears.setText(null);
txtPayment.setText(null);
boxSpace.setText(null);
public static void main(String[] args) //This is the signature of the entry point of all the desktop apps
new MPC();
}This portion to be exact. All the buttons work for me except this one. I need to calculate user input and also use the fixed data that can be found in the dblTrmLoanRate array. When I choos to use user input instead, the program either crashes or for some reason uses the year7InterestRateBtn instead.
if (command == btnCalc)
//dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
//interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
//int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
int months = Integer.parseInt(txtYearsInput.getText() )* 12;
I was going to leave out the remed portion but thought it might help you with the navigation. I am sorry I did not use code tags, but I am going to go find out what those are and use them in the future. -
JButton not working with for loop...
I am still very new to Java and am having trouble grasping it. I am trying to put together a program that paints a graphic and then each time the "Press Me" button is pressed, an oval randomly appears giving the impression that the picture is 'disappearing' a little at a time. When I run it now, 20 ovals randomly appear all at once instead of waiting for the button to be pushed. Does anyone have any advice for me on how to modify the code? Here is what I have so far...
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import java.awt.geom.*;
public class JEraseImage extends JApplet implements ActionListener
private ImageIcon image1 = new ImageIcon("bear.jpg");
int startPosX = 80;
int startPosY = 80;
int imageWidth = 275;
int imageHeight = 250;
Container con = getContentPane();
private JButton pressMeButton = new JButton("Press Me");
public void init()
image1 = new ImageIcon("bear.jpg");
con.setLayout(new FlowLayout());
con.add(pressMeButton);
pressMeButton.addActionListener(this);
public void paint(Graphics gr)
gr.drawImage(image1.getImage(), 80, 80, (this));
Graphics2D gr2D = (Graphics2D)gr;
pressMeButton.repaint();
gr.setColor (Color.white);
for(int count = 0; count < 20; ++count)
int x = (int) (Math.random() * imageWidth) + startPosX;
int y = (int) (Math.random() * imageHeight) + startPosY;
gr.fillOval(x, y, 50, 40);
public void actionPerformed(ActionEvent e)
Object source = e.getSource();
if(source == pressMeButton)
repaint();Here ya go, I think this should do it:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.*;
import javax.swing.*;
import java.awt.geom.*;
public class Junk extends JApplet implements ActionListener
private ImageIcon image1;
BufferedImage bi;
Graphics g;
int x;
int y;
int startPosX = 80;
int startPosY = 80;
int imageWidth;
int imageHeight;
Container con = getContentPane();
JButton pressMeButton = new JButton("Press Me");
public void init()
image1 = new ImageIcon("bear.jpg");
bi = new BufferedImage(image1.getIconWidth(), image1.getIconHeight(), BufferedImage.TYPE_INT_RGB);
g = bi.getGraphics();
g.drawImage(image1.getImage(), 0, 0, null);
con.setLayout(new FlowLayout());
con.add(pressMeButton);
pressMeButton.addActionListener(this);
public void paint(Graphics gr){
super.paint(gr);
gr.drawImage(bi, startPosX, startPosY, this);
public void actionPerformed(ActionEvent e)
g.setColor(Color.WHITE);
Object source = e.getSource();
if(source == pressMeButton)
for(int count = 0; count < 20; ++count)
int x = (int) (Math.random() * imageWidth) + startPosX;
y = (int) (Math.random() * imageHeight) + startPosY;
g.fillOval(x, y, 50, 40);
repaint();
}Note: I've not run this. -
I am having a problem with JButtons and JCheckBoxes in java. I am finding myself having to click the JButtons more than once in some situations to get to the next stage of my GUI. With the JCheckBoxes it sometimes takes a couple of clicks to change the state (unticked -> ticked). This seems to be occurring more than often. Can anyone help?
If there are clicking problems, it's coming from the computer you're on, not java. There isn't much you can do about that
-
MB Air Int. Speakers Not Working
The option for internal speakers went away. Tried everything in these discussions. Only option on output is "headphones". If I do a PRAM reset, or SMC, upon reboot I see the "internal speaker" option, but as soon as I press either the volume button on the keyboard or start some music playing, it goes away and becomes "headphones" again.
This is a new 2013 MB Air. 13". All options.
Thanks in advance.I have this problem too, does it work with headphones?
For me it works with headphones, but not the speakers.
I am running in OS X though, makes me wonder if it is a hardware related problem. -
SetSize(int,int) not working in JTextPane.. Please help
Hi,
I want to set size of JTextPane so that by default it should show atleast 2 lines.
I am using setSize(int, int) , but its not working.
Can anybody help me?hi
From onwards, I will take care of it.. I will put my query in particular category only.
Actually I tried this one also...
Following is my method in which I want to set size of JtextPane
public JPanel initComponents(Vector columnNames, Vector dbNames, Vector data) {
fieldrefs = new JTextComponent[columnNames.size()];
JPanel content = new JPanel();
content.setLayout(new GridBagLayout());
content.setSize(900,900);
// Create Menubar
JMenuBar menuBar = createMenuBar();
setJMenuBar(menuBar);
GridBagConstraints gbc = new GridBagConstraints();
//some code
gbc.gridx = 2;
gbc.gridy = 0;
gbc.insets = new Insets(SG_SwingUtilities.BORDER_COMP, // (top, left, bottom, right)
SG_SwingUtilities.BORDER_COMP, 0, 0);
gbc.anchor = GridBagConstraints.NORTHWEST;
JLabel pathLabel = new JLabel(stringPath);
Font font = new Font(null, Font.BOLD, 12);
pathLabel.setFont(font);
content.add(pathLabel, gbc);
// Insert all the fields.
for (int i = 0, j = 0; i < columnNames.size(); i++, j += 2) {
int gridy = i + 1;
String label = (String) columnNames.elementAt(i); // Name of column.
gbc = new GridBagConstraints();
gbc.gridy = gridy;
gbc.insets = new Insets(SG_SwingUtilities.BORDER_COMP, SG_SwingUtilities.BORDER_COMP, 0, 0);
gbc.anchor = GridBagConstraints.NORTHWEST;
content.add(new JLabel(label), gbc);
if ((i == 4 || i == 5) || (i == 2 && (isMacroNode || isSystemNode))) {
// tagstart and tagend are expanded in HORIZONTAL direction.
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
if(i==5)
styledDocEnd = new DefaultStyledDocument();
fieldrefs[i] = new JTextPane(styledDocEnd);
}else
styledDocStart = new DefaultStyledDocument();
fieldrefs[i] = new JTextPane(styledDocStart);
if (i == 5) {
textarea2 = new JTextPane(styledDocEnd); // I want to set this JtextPane size
textarea2 = (JTextPane)fieldrefs;
fieldrefs[i].setSize(100,500);
tagEndField = new JPanel(new GridBagLayout());
content.add(tagEndField, gbc);
normalComponent2 = new JScrollPane(fieldrefs[i]);
setNormalMode(2);
// my code
else {
// TagStart
textarea1 = new JTextPane(styledDocStart); // I want to set this JtextPane size
textarea1 = (JTextPane)fieldrefs[i];//me
fieldrefs[i].setSize(100,500);
tagStartField = new JPanel(new GridBagLayout());
content.add(tagStartField, gbc);
normalComponent1 = new JScrollPane(fieldrefs[i]);
setNormalMode(1);
/// my code
fieldrefs[i].addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) {
// DOUBLE (left) CLICK
if (data != null && !data.isEmpty()) {
if (data.elementAt(j) != null) {
String insertData = data.elementAt(j) + "";
insertData = insertData.replaceAll("\\&\\{\\}", ""); // remove dummy ref
insertData = insertData.replaceAll("\r", "");
fieldrefs[i].setText(insertData);
if(i==4 || i==2)
insertLineBreaks(textarea1);
updateColors(textarea1.getText(),true); //me
if(i==5)
insertLineBreaks(textarea2);
updateColors(textarea2.getText(),false); //me
else if (i == 5) {
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
fieldrefs[i] = new JTextArea(3, 10);
fieldrefs[i].setForeground(new Color(0, 0, 255));
// ((JTextArea) fieldrefs[i]).setLineWrap(true);
if (data != null && !data.isEmpty()) {
if (data.elementAt(j) != null) {
String insertData = data.elementAt(j) + "";
insertData = insertData.replaceAll("\\&\\{\\}", ""); // remove dummy ref
fieldrefs[i].setText(insertData);
content.add(new JScrollPane(fieldrefs[i]), gbc);
else {
fieldrefs[i] = new JTextArea(2, 10); // description field.
((JTextArea) fieldrefs[i]).setLineWrap(true);
if (data != null && !data.isEmpty()) {
if (data.elementAt(j) != null) {
fieldrefs[i].setText(data.elementAt(j) + "");
content.add(new JScrollPane(fieldrefs[i]), gbc);
//code
return content;
} // initComponents
protected JTextComponent[] fieldrefs = null; is taken from super class
Message was edited by:
ring -
SetMnemonic not working in UNIX
Hello,
I'm tried to set a key mnemonic as follows:
JButton close = new JButton("Close");
close.setMnemonic(KeyEvent.VK_C);
This piece of code works fine in NT but not in UNIX. I tried searching all queries in this forum. I haven't got any inputs ?? Any suggestions ??
Sunil.Hi,
This was the outcome of my research.
I thought of running the app. directly on the Sun server instead of using Exceed emulator (client). I didn't see those warning messages and the mnemonics worked fine.
To answer my question earlier, warning messages are directly related to the issue of mnemonics not working on the client machine.
Still looking into why its not working from any client which uses Exceed.
Thanks,
Sunil. -
GetObject(int, Map) not working with oracle JDBC
I'm using Oracle and I'd like to get Date fields as Timestamps since an Oracle date column includes time. I'm trying to use getObject(int, Map) to map the types to Java objects, but it's not working. This is my code:
public static final HashMap oracleMap = new HashMap();
static{
try{
oracleMap.put( "DATE", Class.forName("java.sql.Timestamp") );
oracleMap.put( "NUMBER", Class.forName("java.math.BigDecimal") );
oracleMap.put( "VARCHAR2", Class.forName("java.lang.String") );
oracleMap.put( "CLOB", Class.forName("java.sql.Clob") );
oracleMap.put( "LONG", Class.forName("java.lang.String") );
}catch(Exception e){
IllegalStateException ise = new IllegalStateException("Oracle type mapping failed.");
ise.initCause(e);
throw ise;
}And
BASE.println("rs.getClass().getName(): "+rs.getClass().getName());
BASE.println("rs.getMetaData().getColumnTypeName(i): "+rs.getMetaData().getColumnTypeName(i));
if(rs.getClass().getName().startsWith("oracle")) valObj = rs.getObject(i, DOMTools.oracleMap);
else valObj = rs.getObject(i);
BASE.println("valObj.getClass().getName(): "+valObj.getClass().getName());Here's a snippet of my output that illustrates the code not working:
rs.getClass().getName(): oracle.jdbc.driver.OracleResultSetImpl
rs.getMetaData().getColumnTypeName(i): DATE
valObj.getClass().getName(): java.sql.Date
Anyone know if this is a driver issue? Anyone had luck doing this with Oracle?
Thanks.Well, I'd like it to be java.sql.Timestamp instead of
java.sql.Date. My actual type is an oracle "DATE".
Are you saying the Map key for this would be
"TIMESTAMP" and that by default it maps to
java.sql.Date? Doesn't seem like that makes sense.I am saying that "TIMESTAMP" is not an oracle value but is instead a JDBC value. Thus it is up to to the driver, not you, to determine what oracle types map to the JDBC type. -
Dear All Experts,
We r running OAS 10g (10.1.2)
On Windows XP Client below command (Merging .INT files in one file hsd.txt) is working perfectly
host('cmd /c copy C:\docsys\*.int C:\docsys\hsd.txt');
But On Windows Vista Clent it's not working and not giving any error.
Please guide to perform this for Windows Vista Clients.
Thanks
Rana
Edited by: Eidy on Jan 23, 2009 1:38 PMI think you may be confusing how Forms applications work. Commands such as HOST and TEXT_IO all execute on the server and not the client. This means that in your case the server (+where Application Server is installed+) must be a Windows platform since you are trying to execute a "Windows" command. Second thing is that because this will execute on the server, the client platform has nothing to do with the problem.
I suspect that previously you tried this code in a Forms Builder environment on WinXP then moved the form (fmb/fmx) to another machine where you then tried accessing it from a Vista client. Run from the Builder using OC4J, the code will work because the server and the client are the same machine. Additionally, when running Application Server additional security issues need to be considered. For example, many command line calls will not execute correctly in AS when the server is any Windows platform because the owner of the frmweb.exe process (OPMN) does not have permission to launch a command windows (cmd).
To permit server side HOST calls to execute correctly on a Windows server, you will need to do the following:
1. In the Windows Services management console, locate the server entry for the Oracle Process Manager for the Middle Tier
2. Open the Properties for this service by double clicking on it.
3. Select the Log on tab
4. Check the box labeled "Allow service to interact with Desktop." Click OK to accept the change.
5. The above change will require restarting OPMN or restarting the machine.
IMPORTANT:
Before making the above change, you should be aware of the impact of doing so. Be sure to refer to the Microsoft documentation which explains the Service options:
http://technet.microsoft.com/en-us/library/cc782435.aspx
Back to the beginning :-)
If you want this type of command to execute on the client, you will need to use a custom Java Bean or WebUtil. Information about WebUtil can be found here:
http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm
Be aware that WebUtil is included in Developer Suite 10.1.2 and should not be downloaded from OTN as the version in 10.1.2 is newer. For Application Server 10.1.2, you will need to copy the appropriate WebUtil files from Developer Suite to your AS environment and configure it. Refer to the documentation and Release Notes all available on the page noted above. -
my email ios not working when i try sending a email it comeback and ask to have e mail address change
my email need to say off line or on line to be able to send e mailHello ivanstudioladesigns,
Thank you for using Apple Support Communities.
For more information, take a look at:
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
iOS: Adding an email account
http://support.apple.com/kb/ht4810
Have a nice day,
Mario -
JTextField.select(int, int) not working in modal JDialog
Hi
I have discovered something peculiar. When I have a JDialog, and it is modal, then the select method of any JTextfield will surely fail. (Only tested on win32)
What the owner is does not matter (even null will give the same result). I made a JFrame for your convenience.
import javax.swing.*;
public class MyDialog extends JDialog
private JTextField tf = new JTextField("not selected >selected< not selected");
public static void main(String[] args)
JFrame f = new JFrame("Some parent frame");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
new MyDialog(f);
public MyDialog(JFrame parent)
super(parent, "Child dialog", /*Selecct modality*/ true);
// super();
super.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
super.add(this.tf);
super.pack();
super.setLocation(0, 50);
super.setVisible(true);
// Selection does not work when dialog is modal.
this.tf.select(14, 22);
this.tf.requestFocus();
}I did not find a bug in the database concerning this.
Did I do something wrong, or should I post this as a bug?1) Please do not dredge posts that are months or years old. If you have something important to say, create your own thread.
2) If you have the same problem, then use the same solution.
3) If this doesn't work, then show your problem: show your code. We don't want to see all of it, but rather you should condense your code into the smallest bit that still compiles, has no extra code that's not relevant to your problem, but still demonstrates your problem, in other words, an SSCCE (Short, Self Contained, Correct (Compilable), Example). For more info on SSCCEs please look here:
http://homepage1.nifty.com/algafield/sscce.html
Also, when posting your code, please use code tags so that your code will be well-formatted and readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
// your code block goes here.
[/code] -
Megacom not working for both LD and Int'l
I got the same issue described here https://supportforums.cisco.com/message/311063#311063 but only differences are my setup is using CCM 4.2 and Cisco 3845's.
To make a LD call to work, I got to set the "Called party IE number type" under the GW config to National; and
To make an Int'l call to work, I got to set this value to International.
If I leave everything default, i.e. Cisco CallManager, only LD works.
Basically, I couldn't make both LD and Int'l to work. It's either one way or the other.
Any workaround to make both to work would be greatly appreciated.
Thanks,
KevinBoth device has automatic download on.
-
Swing components in applet not working in web browser
Hi Guys,
I've created an applet which makes use of some swing components, but unfortunately, not all of them function properly in my web browser (internet explorer or Mozilla Firefox). Its mainly the buttons; the last buttons works and displays the correct file within the broswer, but the first 5 buttons do not work...
any help please on how I can sort this problem out?
Heres the code for my applet:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
public class MainAppWindow extends JApplet
int gapBetweenButtons = 5;
final JPanel displayPanel = new JPanel(new BorderLayout());
public void init()
//Panel for overall display in applet window.
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/smalllogo2.gif"))),BorderLayout.NORTH);
//sub mainPanel which holds all mainPanels together.
JPanel holdingPanel = new JPanel(new BorderLayout());
//Panel for displaying all slide show and applications in.
displayPanel.setBackground(Color.white);
displayPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/IntroPage.jpg"))),BorderLayout.CENTER);
displayPanel.setPreferredSize(new Dimension(590,400));
JPanel buttonPanel = new JPanel(new GridLayout(6,1,0,gapBetweenButtons));
buttonPanel.setBackground(Color.white);
JButton button1 = new JButton("User guide");
button1.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll(); // If there are any components in the mainPanel, remove them and then add label
displayPanel.setBackground(Color.white);
displayPanel.add(new JLabel(new ImageIcon("images/UserGuide.jpg")));
displayPanel.revalidate(); // Validates displayPanel to allow changes to occur onto it, allowing to add different number images/applicaions to it.
JButton button2 = new JButton("What is a Stack?");
button2.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
displayPanel.setBackground(Color.white);
displayPanel.add(new JLabel(new ImageIcon("images/WhatIsAStack.jpg")));
displayPanel.revalidate();
JButton button3 = new JButton("STACK(ADT)");
button3.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
displayPanel.setBackground(Color.white);
displayPanel.add(new JLabel(new ImageIcon("images/StackADT.jpg")));
displayPanel.revalidate();
JButton button4 = new JButton("Stacks in the Real World");
button4.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
displayPanel.setBackground(Color.white);
displayPanel.add(new JLabel(new ImageIcon("images/StacksInTheRealWorld.jpg")));
displayPanel.revalidate();
JButton button5 = new JButton("DEMONSTRATION");
button5.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
Demonstration app = new Demonstration();
JPanel appPanel = app.createComponents();//gets the created components from Demonstration application.
appPanel.setBackground(Color.pink);
displayPanel.add(appPanel);
displayPanel.revalidate();
JButton button6 = new JButton("Towers Of Hanoi");
button6.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
TowerOfHanoi app = new TowerOfHanoi();
JPanel appPanel = app.createComponents();//gets the created components from Towers of Hanoi
JPanel mainPanel = new JPanel();//panel used to centralise the application in center
mainPanel.add(appPanel);
mainPanel.setBackground(Color.pink); //sets mainPanel's background color for 'Towers Of Hanoi'
displayPanel.add(mainPanel);
displayPanel.revalidate();
//adding buttons to the buttonPanel.
buttonPanel.add(button1);
buttonPanel.add(button2);
buttonPanel.add(button3);
buttonPanel.add(button4);
buttonPanel.add(button5);
buttonPanel.add(button6);
JPanel p = new JPanel(); // Used so that the buttons maintain their default shape
p.setBackground(Color.white);
p.add(buttonPanel);
holdingPanel.add(p,BorderLayout.WEST);
holdingPanel.add(displayPanel,BorderLayout.CENTER);
//Positioning of holdingPanel in mainPanel.
mainPanel.add(holdingPanel,BorderLayout.CENTER);
//indent mainPanel so that its not touching the applet window frame.
mainPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
mainPanel.setBackground(Color.white);
mainPanel.setPreferredSize(new Dimension(850,600)); //size of applet window
mainPanel.setOpaque(false); // Needed for Applet
this.setContentPane(mainPanel);
}Thanks for the response. I don't quite understand what you're talking about though. I have, in my humble knowledge, done nothing with packages. I have put the applet class (WiaRekenToolActiz.class is the applet class) in the jar file wia_actiz_archive.jar. From what I read on the tutorial, java looks for the applet class in all the jar files specified. Since I put my CODEBASE as the main url, I thought it baiscally didn't matter where you out the html file.
I shall include the complete html page complete with applet tag to perhaps illuminate a bit more what I mean...
<html>
<head>
<title>Wia Rekenmodule hello!</title>
</head>
<body bgcolor="#C0C0C0">
<applet
CODEBASE= "http://www.creativemathsolutions.nl/test"
ARCHIVE= "Actiz/wia_actiz_archive.jar, Generic/wia_archive.jar"
CODE="WiaRekenToolActiz.class"
WIDTH=915 HEIGHT=555
>
<PARAM NAME = naam VALUE = "Piet Janssen">
<PARAM NAME = gebdag VALUE = "01">
<PARAM NAME = gebmaand VALUE = "06">
<PARAM NAME = gebjaar VALUE = "1970">
<PARAM NAME = geslacht VALUE = "man">
<PARAM NAME = dienstjaren VALUE = "10">
<PARAM NAME = salaris VALUE = "56500">
<PARAM NAME = deeltijdpercentage VALUE = "100">
<PARAM NAME = accountnaam VALUE = "Zorginstelling 'De Zonnebloem'">
</applet>
</body>
</html>
Maybe you are looking for
-
Deskjet 3050 Was previously connected to network but won't connect again. Since I can't read the screen to choose the correct options all I can do is print a test page. thanks!! This question was solved. View Solution.
-
How to change the email of the existing nokia acco...
I have forgotten the password of my existing nokia account password...and can't open the email which is associated with that account because I have forgotten that password too...how to change the existing account email id as I couldn't use the nokia
-
Paragraphs in Pages document with hebrew are not aligning
I have a document that I sent to someone as a word document and it was subsequently wiped from my hard disk. When I got the document back from him any paragraphs iwth Hebrew and English in them would have weird (and frankly very annoying) alignments,
-
How do we allow user to download files?
like doc files...? how to put the link? thanks..
-
This might not be specific to MacBook Pro, but here's my issue.
I received a zip file that I want to add to a WORD for Mac document as a hot link, but I can't seem to do it. Can anyone walk me through the proper way? Thanks.