Problem accessing a objects in a public class
Hello I am have written a program where I am using 2 classes. I have created a JFrame class in one of my classes and I have created a JFormattedtextfield in my other class. How do I place the JFormattedtextfields on the the JFrame which I have created in another class?
This is what I sort of what I mean. Since I am new to java I don't know how to mount the panels onto f here. Also the reason why I did'nt post it on the swing forum is that I got the swing part of the code figured out I just need help with the general programming bit.
public class test {
public static void main(String[] args) {
public test() {
JFrame f = new JFrame("Test Program"); // f is created here
f.setSize(400,400);
f.setVisible(true);
class Layout {
//Fields for data entry
JFormattedTextField test = new JFormattedTextField ();
//Panels
JPanel secondaryPanel = new JPanel();
public Layout(){
test.setForeground(Color.black);
f.add(secondaryPanel); // How do I mount this panel onto f here
}
Similar Messages
-
Problem accessing an object in a VBox
Hi!
I have a problem accessing an object which is in a VBox.
I made an example so you can see my problem. I am trying to
access pnlChat.
If you load the swf you won't see the Alert because there is
something wrong (and I don't know what)
If you try to remove the <mx:VBox> tags that wrap the
pnlChat Panel, it will work.
Why can't I access this object when it is in a VBox?
Thanks"Jimmy Jeeves" <[email protected]> wrote in
message
news:g8jv84$5ib$[email protected]..
> Hi!
>
> I have a problem accessing an object which is in a VBox.
> I made an example so you can see my problem. I am trying
to access
> pnlChat.
> If you load the swf you won't see the Alert because
there is something
> wrong
> (and I don't know what)
> If you try to remove the <mx:VBox> tags that wrap
the pnlChat Panel, it
> will
> work.
>
> Why can't I access this object when it is in a VBox?
From the FAQ I'm compiling:
Q: I need to set a property or add an event listener on a
component
that is in a ViewStack/TabNavigator/Accordion. When the
component is not
the first child of the Navigator Container, I get a null
object error
(#1009). What causes this, and how can I fix it?
A: By default, the Navigator containers only create the
children of
each pane as that pane is viewed. The easy way to fix this is
to set the
creationPolicy on the Navigator to "all." However, this will
cause your
application to take longer to load. A better way to fix this
is to wait for
a later event, such as creationComplete on the component you
want to access,
or to use binding to "pull" the data into the component.
The way I handle it is to call invalidateProperties() on
change of the
ViewStack. I then override commitProperties() and call an
"initializer" for
each pane. In the body of each initializer function, I check
to see if the
selectedItem for the viewStack is the one my initalizer cares
about. If
not, I return from the function immediately. Inside that
initializer
function, I set properties and add listeners as appropriate. -
Problem Accessing Instantiated Objects
I'm sorry for the long code that follows. Am hoping that someone can point out some ideas for how to structure this properly. Following my instructor's cookie requirements, the first panel two user inputed balances and an interest rate. Two objects are instantiated, one for each balance, in a seperate class. The results of 12 months of savings are then displayed in the 2nd panel. There is then the required option to change the interest rate. When modified, it should show the new interests and balances for the original balances instead.
I successfully got the first set of interests and new balances, and thought, "sweet! I'm home free now!"
Because God himself hates me, this is of course not the case. It's not recognizing the objects in the second event, which is modifying the interest rate.
I'm not sure how I can restructure this so that the objects which are instantiated using user input can be accessible by both events. If anybody can suffer through looking at all this junk and has some ideas (or even just some general advice on how to manipulate objects), I'd appreciate it.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
public class SavingsTest extends JFrame
private JLabel balanceLabel, dollaSign, balanceLabel2, dollaSign2, percentSign, rateLabel;
private JTextField balanceField, balanceField2, rateField;
private JTextArea displayArea;
private JButton submitButton, modifyButton;
private String cBalance1S, cBalance2S, intRateS;
private double cBalance1, cBalance2, intRate, oldBalance1, oldBalance2;
// Constructor creates frame
public SavingsTest ()
super( "Savings Calculator" );
Container container = getContentPane();
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new FlowLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
* INPUT PANEL *
JPanel inputPanel = new JPanel();
inputPanel.setLayout(null);
inputPanel.setPreferredSize(new Dimension(500,250));
// inputPanel.setBackground(Color.white);
inputPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Enter Data"),
BorderFactory.createEmptyBorder(5,5,5,5)));
// Consumer 1 Balance Components
balanceLabel = new JLabel ("Enter Customer 1 balance:");
balanceLabel.setBounds(85,25,168,24);
inputPanel.add(balanceLabel);
dollaSign = new JLabel ("$ ");
dollaSign.setBounds(125,55,168,24);
inputPanel.add(dollaSign);
balanceField = new JTextField(10);
balanceField.setBounds(145,55,50,24);
inputPanel.add(balanceField);
// Consumer 2 Balance Components
balanceLabel2 = new JLabel ("Enter Customer 2 balance:");
balanceLabel2.setBounds(265,25,168,24);
inputPanel.add(balanceLabel2);
dollaSign2 = new JLabel ("$ ");
dollaSign2.setBounds(305,55,168,24);
inputPanel.add(dollaSign2);
balanceField2 = new JTextField(10);
balanceField2.setBounds(325,55,50,24);
inputPanel.add(balanceField2);
// Interest Rate Components
rateLabel = new JLabel ("Enter annual rate :");
rateLabel.setBounds(215,105,168,24);
inputPanel.add(rateLabel);
percentSign = new JLabel ("% ");
percentSign.setBounds(215,145,168,24);
inputPanel.add(percentSign);
rateField = new JTextField(10);
rateField.setBounds(235,145,50,24);
inputPanel.add(rateField);
// Submit Button Component
submitButton = new JButton("SUBMIT");
submitButton.setBounds(215, 185, 80, 30);
inputPanel.add(submitButton);
mainPanel.add(inputPanel);
* DISPLAY PANEL *
JPanel displayPanel = new JPanel();
displayPanel.setLayout(null);
displayPanel.setPreferredSize(new Dimension(500,375));
displayPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Monthly Interest & Balances"),
BorderFactory.createEmptyBorder(5,5,5,5)));
// Modify Interest Rate Button Component
modifyButton = new JButton("Modify Rate");
modifyButton.setEnabled( false );
modifyButton.setBounds(215, 25, 80, 30);
displayPanel.add(modifyButton);
// Display Area Component
displayArea = new JTextArea();
displayArea.setEditable(false);
displayArea.setBounds(25,85,445,275);
displayPanel.add(displayArea);
mainPanel.add(displayPanel);
* MAIN PANEL *
container.add( mainPanel);
setSize(630, 700);
setVisible( true );
* SUBMIT BUTTON EVENT *
submitButton.addActionListener(
new ActionListener()
{ // Open ActionListener
public void actionPerformed (ActionEvent e)
getInput();
} // Close ActionListener
* MODIFY BUTTON EVENT *
modifyButton.addActionListener(
new ActionListener()
{ // Open ActionListener
public void actionPerformed (ActionEvent e)
modifyInput();
} // Close ActionListener
} // End Constructor
public static void main ( String args[] )
SavingsTest initiate = new SavingsTest();
initiate.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
private void getInput()
// Get values from fields and assign to Strings
cBalance1S = balanceField.getText();
balanceField.setText("");
cBalance2S = balanceField2.getText();
balanceField2.setText("");
intRateS = rateField.getText();
rateField.setText("");
// Parse Strings to doubles, etc
cBalance1 = Double.parseDouble(cBalance1S);
cBalance2 = Double.parseDouble(cBalance2S);
intRate = Double.parseDouble(intRateS);
intRate = intRate * .01;
oldBalance1 = cBalance1;
oldBalance2 = cBalance2;
submitButton.setEnabled( false );
modifyButton.setEnabled( true );
SavingsAccount account1 = new SavingsAccount(cBalance1, intRate);
SavingsAccount account2 = new SavingsAccount(cBalance2, intRate);
displayArea.append("\t Account 1\t\t Account 2\n");
displayArea.append("\tInterest\tBalance\tInterest\tBalance\n");
DecimalFormat twoDigits = new DecimalFormat( "0.00");
// Calculate Interests & Balances, then display
for (int i = 1; i <13; i++)
double interest1 = account1.calculateMonthlyInterest ();
double interest2 = account2.calculateMonthlyInterest ();
double newBalance1 = account1.calculateNewBalance(interest1);
double newBalance2 = account2.calculateNewBalance(interest2);
displayArea.append("Month " + i + ":\t" + twoDigits.format(interest1)
+ "\t" + twoDigits.format(newBalance1) + "\t" +
twoDigits.format(interest2) + "\t" + twoDigits.format(newBalance2)
+ "\n");
private void modifyInput()
intRateS = JOptionPane.showInputDialog(" Enter new annual rate: ");
intRate = Double.parseDouble(intRateS);
SavingsAccount.modifyInterestRate(intRate);
displayArea.setText("");
displayArea.append("\t Account 1\t\t Account 2\n");
displayArea.append("\tInterest\tBalance\tInterest\tBalance\n");
DecimalFormat twoDigits = new DecimalFormat( "0.00");
// Calculate Interests & Balances, then display
for (int i = 1; i <13; i++)
// ERROR IS HERE WHERE IT DOES NOT RECOGNIZE THE OBJECTS
double interest1 = account1.calculateMonthlyInterest ();
double interest2 = account2.calculateMonthlyInterest ();
double newBalance1 = account1.calculateNewBalance(interest1);
double newBalance2 = account2.calculateNewBalance(interest2);
displayArea.append("Month " + i + ":\t" + twoDigits.format(interest1)
+ "\t" + twoDigits.format(newBalance1) + "\t" +
twoDigits.format(interest2) + "\t" + twoDigits.format(newBalance2)
+ "\n");
I believe I did indeed state was not being recognized.I didn't see it. But then, I didn't read all your code either. That's not me (or paul) being an asshole--it's just too much code.
Besides in the content of my post, if I were a
gambling woman, I'd wager it's probably within that
code which you went through so much trouble to make
sure everybody knows you aren't reading. He wasn't doing that for anybody's benefit but your own. That is a lot of code to read. Pasting in the exact error message the compiler gave you would have made it a lot easier for someone to help you. Yawmark waas very kind, but in general, if you want help here, you should post details about what the problem is. "Not recognizing objects" means next to nothing, but the actual error message tells us a lot. In fact, you should take a stab at reading it yourself. Error messages are your friends. They tell you pretty precisely what was wrong and where.
It says
exactly where the objects are unrecognizable. It's
even in big, red, pretty letters.The compiler gave you a lot more detail than that. You didn't indicate which objects.
But why make posts which make coherent sense when you
could just make an ass of yourself without all that
silly reading.Paul's comments were intended to goad you into posting something that would make it easier for people to help you.
>
For example, complaining that there's too much code
(having seen only half the code at that), It doesn't matter if that was only 0.001% of your code. It's too much to post here for that problem. It's understandable that you wouldn't know that, as you're new here, but copping an attitude instead of accepting the constructive criticism doesn't really accomplish anything.
The only thing lending itself to the idea that God
hates me is the fact that he let some idiot such as
yourself wonder into this thread. There are some
brilliant, wonderful, kind, and very helpful people on
these forums to which I am eternally grateful. Then I
guess there's also you.Actually, paulcw helps a lot of people here. Like most of us, he gets annoyed sometimes at poorly constructed questions.
I hope that you won't take the above as a personal attack. It's not intended that way. It's intended to be constructive criticism. -
Problem accessing child object and changing its appearance (color)
For a program, I need to be able to access a child object (in this case a box) after adding it to a transform group and change its appearance, for example the color of its top face. I have included a small code example to show my problem. The box is the only child I have added to the TransformGroup, but when I call getChild(), it returns a node, and thus I can't then call getShape() to get the top face and change its appearance. What am I doing wrong?
public BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
Transform3D rotate = new Transform3D();
Transform3D tempRotate = new Transform3D();
rotate.rotX(Math.PI/4.0d);
tempRotate.rotY(Math.PI/4.0d);
rotate.mul(tempRotate);
TransformGroup objRotate = new TransformGroup(rotate);
objRoot.addChild(objRotate);
Appearance ap = new Appearance();
Appearance app = new Appearance();
Appearance apr = new Appearance();
ColoringAttributes colr = new ColoringAttributes();
ColoringAttributes colg = new ColoringAttributes();
colr.setColor((float)1, (float)0, (float)0);
ap.setColoringAttributes(colr);
colg.setColor((float)0,(float)1, 0);
apr.setColoringAttributes(colg);
Box box = new Box((float)0.4, (float)0.4, (float)0.4, app);
box.getShape(4).setAppearance(ap);
objRotate.addChild(box);
objRotate.getChild(0).getShape(4).setAppearance(ap);
objRoot.compile();
return objRoot;
}It would help if you gave us the following System information:
Operating System/version
Photoshop version number
Amount of RAM installed
Hard drive(s) capacity
Make and model number of video card
Also try resetting your preferences as described in the FAQ.
http://forums.adobe.com/thread/375776?tstart=0
You either have to physically delete (or rename) the preference files or, if using the Alt, Ctrl, and Shift method, be sure that you get a confirmation dialog.
This resets all settings in Photoshop to factory defaults.
A complete uninstall/re-install will not affect the preferences and a corrupt file there may be causing the problem. -
Problem accessing exception object in jsp error page - Apache Tomcat 5.0.25
Hi all,
I'm thoroughly confused and need some help. I've deployed a very simple web application in Apache Tomcat 5.0.25 to test exception handling - errortest.jsp and error.jsp. errortest.jsp throws a divide by zero exception if executed with default values in text fields.
When I put the directive IsErrorPage="true" in error.jsp i get a HTTP 500 error when error.jsp is accessed. If I remove it error.jsp is displayed but I cant access the exception object - if I try to I get an exception below:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /error.jsp
Generated servlet error:
[javac] Compiling 1 source file
E:\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mywebapp\org\apache\jsp\error_jsp.java:46: cannot resolve symbol
symbol : variable exception
location: class org.apache.jsp.error_jsp
out.print(exception.getMessage());
^
1 error
Below is the code for the two jsp pages:
errortest.jsp:
<%@ page errorPage="error.jsp" %>
<html>
<head><title>Error test</title></head>
<body>
<form action="errortest.jsp" method="post">
Enter first number:<input type="text" name="first" value="5"/><br>
Enter second number:<input type="text" name="second" value="0"/><br>
<input type="submit"/>
</form>
<%
if (request.getMethod().equals("POST")) {
int first = Integer.parseInt( request.getParameter( "first" ) );
int second = Integer.parseInt( request.getParameter( "second" ) );
int answer = first/second;
%>
</body>
</html>
NB: I am able to catch and display the exception if I use a try/catch block around the division as shown below.
try {
int answer = first/second;
} catch( Exception e) {
e.printStackTrace( new PrintWriter(out) );
error.jsp (first draft)
NB: HTTP 500 error occurs when directive "isErrorPage" is added:
<%@ page isErrorPage="true" %>
<html>
<head><title>Error Page</title></head>
<body>
</body>
</html>
error.jsp (second draft)
NB: directive is removed but exception thrown when implicit exception object is accessed. error.jsp displays if exception object is not accessed:
<%@ page %>
<html>
<head><title>Error Page</title></head>
<body>
<%=exception.getMessage()%>
</body>
</html>
Web server specs:
Apache Tomcat 5.0.25
Machine specs:
Windows XP Pro
Java environments:
j2sdk1.4.2_03
J2EE 1.4This works for me:
throwError.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" errorPage="/error.jsp"
contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>Throw Exception</title>
</head>
<body>
Throwing exception....
<%
// throw ArithmeticException
int badInt = 12/0;
%>
</body>
</html>
error.jsp
<%@ page language="java" isErrorPage="true" %>
<head><title>Doh!</title></head>
An Error has occurred in this application.
<% if (exception != null) { %>
<pre><% exception.printStackTrace(new java.io.PrintWriter(out)); %></pre>
<% } else { %>
Please check your log files for further information.
<% } %> -
Problem accessing Document object UDF
Hey All,
I am trying to build a custom application for a company that us using SBO patch level 21. Unfortunately they cannot upgrade to a newer patch level at this time.
I use the following code to check the existence of a UDF field:
if(myDocument.Lines.UserFields.Fields.Item(udfField) != null)
{ myDocument.Lines.UserFields.Fields.Item(udfField).Value = udfVal;
For some reason the DI API throws an exception to say it cannot find the UDF. Even though it exists in the database. I have tried a number of UDFs all of which exist and they all throw the exception.
Any ideas?Lita,
I wasn't lucky as you!
I even tried to access to the user field by index but I always get a COM exception: FFFFFBAF
Here's the code still not working properly:
SAPbobsCOM.Documents d = (SAPbobsCOM.Documents) B1Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders); // Same problem on other documents...
SAPbobsCOM.Document_Lines dl = d.Lines;
dl.SetCurrentLine(0);
try
int n = d.UserFields.Fields.Count;
string fld = dl.UserFields.Fields.Item(0).Description;
//int j = dl.UserFields.Fields.Count;
catch (System.Exception e)
B1App.MessageBox(e.Message, 0, "OK", "", "");
This problem is a nightmare because we have severals customer add-ons based on document lines user fields!!! -
Problem accessing another public ip in same subnet
Hi,
I have searched around for a previous post regarding this but can't find an issue similar to mine (or I'm just too stupid to understand that it is )
I have a Cisco 5505 at a small business that I help. The problem is that the ISP are providing public IPs to multiple customers in a /24 subnet. The ASA has a single public IP configured 8.8.8.8 (not really, just for the examples sake) with a subnet mask of 255.255.255.0.
The webserver I have to access is not managed by me and is located in a different location (same town though) has 8.8.8.115, it is located in the same subnet as the ASA.
How would I make this work? I have tried to configure a static arp entry for the web server but it just won't work. If i place a computer directly on the outside interface I have no problem accessing the web server.
I am running ASA version 8.2, but I could upgrade if it would help me solve the problem.
Any help with this issue is much appreciated.The ISP only specify one gateway in that range and that is 8.8.8.1 so any other would not let me access internet.
Once again thank you for your time.
: Saved
ASA Version 8.2(1)
hostname ciscoasa
domain-name XXXXXXX
enable password XXXXXXX encrypted
passwd XXXXXXX encrypted
names
name 8.8.8.8 Outside_IP
name 192.168.20.2 Server
name 192.168.20.11 rav-dc01
name 192.168.20.12 rav-ms01
name 192.168.20.13 rav-rds01
interface Vlan1
nameif inside
security-level 100
ip address 192.168.20.1 255.255.255.0
interface Vlan2
nameif outside
security-level 0
ip address Outside_IP 255.255.255.0
interface Ethernet0/0
switchport access vlan 2
interface Ethernet0/1
interface Ethernet0/2
interface Ethernet0/3
interface Ethernet0/4
interface Ethernet0/5
interface Ethernet0/6
interface Ethernet0/7
boot system disk0:/asa821-k8.bin
ftp mode passive
dns server-group DefaultDNS
domain-name XXXXXXX
same-security-traffic permit inter-interface
same-security-traffic permit intra-interface
object-group protocol TCPUDP
protocol-object udp
protocol-object tcp
access-list inside_nat0_outbound extended permit ip any 192.168.25.0 255.255.255.0
access-list RemoteVPNSplittunnel standard permit 192.168.20.0 255.255.255.0
access-list outside_access_in extended permit tcp host 100.100.100.228 interface outside eq 3389
access-list outside_access_in extended permit tcp any interface outside eq smtp
access-list outside_access_in extended permit udp any interface outside eq 4125
access-list outside_access_in extended permit tcp any interface outside eq 4125
access-list outside_access_in extended permit tcp any interface outside eq https
access-list outside_access_in extended permit tcp any interface outside eq pptp
access-list outside_access_in extended permit tcp any interface outside eq 444
access-list outside_access_in extended permit gre any interface outside
access-list outside_access_in extended permit udp any interface outside eq 444
access-list outside_access_in extended permit tcp any interface outside eq www
access-list inside_access_in extended permit tcp host rav-ms01 any eq smtp
access-list inside_access_in extended deny tcp any any eq smtp
access-list inside_access_in extended permit ip any any
pager lines 24
logging enable
logging asdm informational
mtu inside 1500
mtu outside 1500
ip local pool RemoteVPNPool 192.168.25.100-192.168.25.200 mask 255.255.255.0
icmp unreachable rate-limit 1 burst-size 1
asdm image disk0:/asdm-621.bin
no asdm history enable
arp timeout 14400
global (outside) 1 interface
nat (inside) 0 access-list inside_nat0_outbound
nat (inside) 1 0.0.0.0 0.0.0.0
static (inside,outside) udp interface 4125 Server 4125 netmask 255.255.255.255
static (inside,outside) tcp interface 4125 Server 4125 netmask 255.255.255.255
static (inside,outside) tcp interface https rav-ms01 https netmask 255.255.255.255 dns
static (inside,outside) tcp interface pptp Server pptp netmask 255.255.255.255
static (inside,outside) tcp interface 3389 rav-rds01 3389 netmask 255.255.255.255 dns
static (inside,outside) tcp interface smtp rav-ms01 smtp netmask 255.255.255.255
static (inside,outside) udp interface 444 Server 444 netmask 255.255.255.255
static (inside,outside) tcp interface 444 Server 444 netmask 255.255.255.255
static (inside,outside) tcp interface www Server www netmask 255.255.255.255 dns
access-group inside_access_in in interface inside
access-group outside_access_in in interface outside
route outside 0.0.0.0 0.0.0.0 8.8.8.1 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
dynamic-access-policy-record DfltAccessPolicy
aaa-server rav_Intern protocol radius
aaa-server rav_Intern (inside) host rav-dc01
key CiscoAsa5505RAV2012
radius-common-pw CiscoAsa5505RAV2012
http server enable 8080
http 192.168.20.0 255.255.255.0 inside
http 192.168.25.0 255.255.255.0 inside
http 100.100.101.128 255.255.255.192 outside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
sysopt connection timewait
crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
crypto dynamic-map outside_dyn_map 20 set pfs
crypto dynamic-map outside_dyn_map 20 set transform-set ESP-3DES-SHA
crypto map outside_map 65535 ipsec-isakmp dynamic outside_dyn_map
crypto map outside_map interface outside
crypto isakmp enable outside
crypto isakmp policy 10
authentication pre-share
encryption aes-256
hash sha
group 2
lifetime 86400
telnet 192.168.20.0 255.255.255.0 inside
telnet timeout 5
ssh 192.168.20.0 255.255.255.0 inside
ssh timeout 5
console timeout 0
management-access inside
dhcpd auto_config outside
dhcpd address 192.168.20.190-192.168.20.200 inside
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
ntp server rav-dc01 source inside
webvpn
group-policy RemoteVPN internal
group-policy RemoteVPN attributes
wins-server value 192.168.20.11
dns-server value 192.168.20.11
vpn-tunnel-protocol IPSec
split-tunnel-policy tunnelspecified
split-tunnel-network-list value RemoteVPNSplittunnel
default-domain value rav.nu
split-dns value rav.nu
username SupportVPN password XXXXXXX encrypted privilege 0
username SupportVPN attributes
vpn-group-policy RemoteVPN
tunnel-group RemoteVPN type remote-access
tunnel-group RemoteVPN general-attributes
address-pool RemoteVPNPool
authentication-server-group rav_Intern
accounting-server-group rav_Intern
default-group-policy RemoteVPN
tunnel-group RemoteVPN ipsec-attributes
pre-shared-key *
class-map inspection_default
match default-inspection-traffic
policy-map global_policy
class inspection_default
inspect pptp
inspect icmp
inspect icmp error
service-policy global_policy global
prompt hostname context
Cryptochecksum:8481ab3aa01b23bad17bacb2aca7197a
: end
asdm image disk0:/asdm-621.bin
no asdm history enable -
Accessing object of the main class from the thread
Hi, I'm having problem accessing object of the main class from the thread. I have only one Thread and I'm calling log.append() from the Thread. Object log is defined and inicialized in the main class like this:
public Text log; // Text is SWT component
log = new Text(...);Here is a Thread code:
...while((line = br.readLine())!=null) {
try {
log.append(line + "\r\n");
} catch (SWTException swte) {
ErrorMsg("SWT error: "+swte.getMessage());
}Error is: org.eclipse.swt.SWTException: Invalid thread access
When I replace log.append(...) with System.out.println(..) it works just fine, so my question is do the log.append(..) the right way.This is NOT a Java problem but a SWT specific issue.
It is listed on the SWT FAQ page http://www.eclipse.org/swt/faq.php#uithread
For more help with this you need to ask your question on a SWT specific forum, there is not a thing in these forums. This advice isn't just about SWT by the way but for all specific API exceptions/problems. You should take those questions to the forum or mailing list for that API. This forum is for general problems and exceptions arising from using the "core" Java libraries. -
Problems accessing class in JAR file [err = -4000]
Hi, my setup is as follows ....
I have a seq file that is accessing a Java class file, TestStandClient.java. something like
public class TestStandClient
public String test (String arg)
String returnVal = "";
try
TestClass testClass = new TestClass ();
returnVal = testClass .test (arg);
catch (Exception e)
returnVal = e .toString();
return returnVal;
TestClass.java is
public class TestClass
public String test (String arg)
return arg + " : [Jar object has modified string]";
Now. TestClass is in a seperate jar. When TestStandClient :: test is called i get a -4000 error. From the readme in the Java example file it is described as ....
Error
reading returned string
The
string returned from Java was corrupt. Verify that the return type of the Java
method is a string value.
I have noticed if I take out the call to the object in the jar file then everything works ok.
Could it be a classpath problem? the StartJVM has its classpath
pointing at the folder where the jar is and also at where the
TestStandClient class file is. I also set the classpath for the Java
step to be the same (location of jar and class file)
So, can someone inform me of what support TestStand has for java? Does it support communicating with a class file that itself depends on other JAR files? This is surely the case?
thanks in advanceDear PCR Barry,
I am afraid that I must agree with my colleague Kostas, who replied to your first teststand post. These are very tricky, indepth issues, and will require quite significant investigation. Furthermore, it will be very difficult for us to answer via the forums as we will likely need more input from yourself. As previously suggested, if you have a Standard Service Program (SSP), you can generate a Service Request by calling or e-mailing your local branch.
Thank you for your time, and I am sorry that I have been unable to help you further,
Best wishes,
Rich R
Applications Engineer
National Instruments UK & Ireland -
Please Help!!! Problems access other classes methods
I am having a problem accessing another classes methods varibles. I have tried a number of ways but with no success. Here is my problem:
I have the main(), from there it's calls the class GetVar(), GetVar stores info in Class HousingForVar(), and finially, I have a class TryinToTalkToHousing() that I use to access HousingForVar()'s methods. I know I can use the keyword new but if I do that then it erases over the data I put in. Please can anyone help, this has been driving me nutz all day. Thank you in advance.
Roman03
***EACH CLASS IS A DIFFERENT FILE****
public class TestMain
public static void main( String args[] )
GetVar getVarible = new GetVar();
getVarible.heroF();
import java.util.Scanner;
public class GetVar
public void heroF()
String someEntered;
Scanner input = new Scanner( System.in);
System.out.println("Enter a string: ");
someEntered = input.next();
HousingForVar houseForData = new HousingForVar(someEntered);
System.out.printf("Retieved from Class GetVar, you entered: %s\n", houseForData.getCollectVar() );
import java.util.Scanner;
public class HousingForVar
private String getData;
public HousingForVar(String enterInfo)
getData = enterInfo;
public void setGetVar(String enterInfo)
getData = enterInfo;
public String getCollectVar()
return getData;
import java.util.Scanner;
public class TryinToTalkToHousing
public void someMeth()
String getInfoFromHousing;
System.out.printf("Started out at TryinToTalkToHousing Class\n Retieved from Class GetVar from %s\n",
houseForData.getCollectVar() );
\* I know this doesn't work, but if I make a new object of the class HousingForVar it's going to write over my input, so what do I do? I am still learning, Please help*\I don't use 1.5, so you'll have to convert it back, but see if you can follow the flow of this
import java.io.*;
class TestMain
GetVar getVarible;
public TestMain()
getVarible = new GetVar();
getVarible.heroF();
System.out.println("******");
new TryinToTalkToHousing(this).someMeth();
public static void main(String[] args){new TestMain();}
class GetVar
HousingForVar houseForData;
public void heroF()
try
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a string: ");
String someEntered = br.readLine();
houseForData = new HousingForVar(someEntered);
System.out.println("Retieved from Class GetVar, you entered: "+houseForData.getCollectVar()+"\n");
catch(Exception e){e.printStackTrace();}
class HousingForVar
private String getData;
public HousingForVar(String enterInfo)
getData = enterInfo;
public void setGetVar(String enterInfo)
getData = enterInfo;
public String getCollectVar()
return getData;
class TryinToTalkToHousing
TestMain parent;
public TryinToTalkToHousing(TestMain t){parent = t;}
public void someMeth()
System.out.println("Started out at TryinToTalkToHousing Class\n"+
"Retieved from Class GetVar, you entered: "+parent.getVarible.houseForData.getCollectVar()+"\n");
} -
Accessing display object on the stage from another class
I've googled this to no avail, I've only found how to manipulate the stage itself and not a display object on it, and I'm noob enough to not be able to figure it out from there. :/
I have a movie clip on the main timeline with instance name displayName. I created a button that should change what frame displayName goes to (in order to...did you guess it?! diplay the Name of the button. Awesome. )
So I am trying to write the code in a reusable fashion and have the buttons all linked to a class called GeoPuzzle. Inside GeoPuzzle I instantiate a touch event and run the code. However, the function has to be able to change displayName in the main part of the timeline and, of course, the compiler says displayName doesn't exist because I'm in a class and I'm talking about the stage.
Here is the simplified code in the class:
package com.freerangeeggheads.puzzleography {
import flash.display.MovieClip;
import flash.events.TouchEvent;
public class GeoPuzzle extends MovieClip {
//declare variables
public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
//set parameters
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
public function GeoPuzzle (): void {
public function geoTouchBeginHandler (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
//some other methods
nameDisplay.gotoAndStop(e.target.abbrev);
public function geoTouchEndHandler (e:TouchEvent): void {
//some other methods
nameDisplay.gotoAndStop("USA");
The lines in bold are my problem. Now this code doesn't actually execute as is so if you see an error in it, yeah, I have no idea what the problem is, but it DID execute before and these lines still gave me trouble so I'm trying to troubleshoot on multiple fronts.
How can I tell displayName to change it's current frame from within display object class?
Thanks!if displayName is a GeoPuzzle instance, use:
package com.freerangeeggheads.puzzleography {
import flash.display.MovieClip;
import flash.events.TouchEvent;
public class GeoPuzzle extends MovieClip {
//declare variables
public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
//set parameters
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
public function GeoPuzzle (): void {
public function geoTouchBeginHandler (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
//some other methods
this.gotoAndStop(this.abbrev);
public function geoTouchEndHandler (e:TouchEvent): void {
//some other methods
this.gotoAndStop("USA"); -
Problem in Accessing User Objects from ADS
hi,
I am trying to search for the users from the root domain exchange.com in Active Directory Service
I am getting an exception like this
javax.naming.PartialResultException: Unprocessed Continuation Reference(s); rema
ining name 'dc=exchange,dc=com'
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2695)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2669)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1757)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1680)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirCon
text.java:368)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCom
positeDirContext.java:328)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCom
positeDirContext.java:313)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.jav
a:238)
at SearchActive.main(SearchActive.java:55)
The Code I used is as follows
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
import java.util.Enumeration;
public class SearchActive
public static void main(String[] args)
// rechargement de l'environnement de l'initialisation du context
DirContext ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://200.200.200.12/");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,"200.200.200.12\\Administrator");
// specify the username
// env.put(Context.SECURITY_CREDENTIALS,"digactive");
// specify the password
try {
// Crer le context initial
ctx = new InitialDirContext(env);
System.out.println("8");
SearchControls cons = new SearchControls();
cons.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration answer = ctx.search("dc=exchange,dc=com","objectclass=user",cons);
while(answer.hasMore())
SearchResult result = (SearchResult)answer.next();
Attributes rattr = result.getAttributes();
for(NamingEnumeration ne = rattr.getAll();ne.hasMore();)
Attribute natt = (Attribute)ne.next();
String sid = natt.getID();
for(Enumeration vals = natt.getAll();vals.hasMoreElements();)
System.out.println(sid+": "+vals.nextElement());
catch(Exception e)
e.printStackTrace();
Can anybody tell me where is the problem
Thanks
ThiruHi, all
Please help me to check where is wrong for the code to access LDAP and get a user's email address.
The code is shown below.
It works before calling ctx.getAttributes, and it shows the error msg as below after calling ctx.getAttributes.
"Problem getting attribute:javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C0905FF, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, veceFinished executing"
I don't know if the getAttributes parameter setting is wrong or the env constant setting wroong.
package com.mycompany;
import java.io.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.DirContext;
import javax.naming.directory.Attributes;
import javax.naming.NamingException;
public class aaa
public static void main(String args[]) throws Exception
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://mycompany.com");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,"mycompany.com/Administrator/");
env.put( Context.REFERRAL, "follow" );
try
System.out.println("0");
// Create the initial directory context
DirContext ctx = new InitialDirContext(env);
System.out.println("1");
Attributes attrs = ctx.getAttributes("cn=andym,cn=Users,dc=mycompany,dc=com");
System.out.println("mail: " + attrs.get("mail").get());
catch (NamingException e)
System.err.println("Problem getting attribute:" + e); -
Accessing view object class (impl) method from bean (or vice versa)
Halo everyone, I am using JDeveloper 11.1.2.1.0
I have a UsersViewImpl class with a method which refresh the user table like below.
public void resetEmployeeSearch() {
removeApplyViewCriteriaName("viewCriteria");
executeQuery();
and I have a UserBean class with a method which reset the search fields values like below.
public void resetInput(ActionEvent actionEvent) {
........RichInputText = input ...
input.setValue("");
AdfFacesContext.getCurrentInstance().addPartialTarget(searchForm);
I would like to implement it in such a way that, once I press a button, both methods will be called.
I have tried to call from bean method using UsersViewImpl vs = new UsersViewImpl ..... which is wrong and wont work.
I have read about doing something like ViewObject vo = am.findViewObject("DeptView1") but I duno how to use it because I cant have a proper example.
Any suggestion on accessing view object class (impl) method from bean (or vice versa)?
Or is there any way to combine both method in the same class ?
Thank you :(User, if you get class not found exceptions you need to tell us which classes you can't find. The JSFUtils and ADFUtils classes needing some other libraries which should already be part of your Fusion Web Application template (which your adf application should be based on). If you did not use this application template, you may have to add some libraries yourself.
What is the diff of using the ADFUtils and OperationBinding way?
The ADFUtils can get you access to the application module which you then use to call exposed methods on. The disadvantage of doing this is that you have to implement your own exception framework which then handles exceptions thrown by the application module. An other thing is that if you e.g. alter a VO which you use on the page this changes are not seen on the page until you refresh the page. The binding layer does not know about these changes so the iterators (which are used on the page to show the data) are not refreshed and so you don't see the changes.
In general you should avoid using the application modul in a managed bean method and always use the binding layer (OperationBinding) to call methods. This ensures that exceptions are all handled the same way and that changes to the data model are reflected in the GUI.
Timo -
Problem with constructors and using public classes
Hi, I'm totally new to Java and I'm having a lot of problems with my program :(
I have to create constructor which creates bool's array of adequate size to create a sieve of Eratosthenes (for 2 ->n).
Then it has to create public method boolean prime(m) which returs true if the given number is prime and false if it's not prime.
And then I have to create class with main function which chooses from the given arguments the maximum and creates for it the sieve
(using the class which was created before) and returns if the arguments are prime or not.
This is what I've written but of course it's messy and it doesn't work. Can anyone help with that?
//part with a constructor
public class ESieve {
ESieve(int n) {
boolean[] isPrime = new boolean[n+1];
for (int i=2; i<=n; i++)
isPrime=true;
for(int i=2;i*i<n;i++){
if(isPrime[i]){
for(int j=i;i*j<=n;j++){
isPrime[i*j]=false;}}}
public static boolean Prime(int m)
for(int i=0; i<=m; i++)
if (isPrime[i]<2) return false;
try
m=Integer.parseInt(args[i]);
catch (NumberFormatException ex)
System.out.println(args[i] + " is not an integer");
continue;
if (isPrime[i]=true)
System.out.println (isPrime[i] + " is prime");
else
System.out.println (isPrime[i] + " is not prime");
//main
public class ESieveTest{
public static void main (String args[])
public static int max(int[] args) {
int maximum = args[0];
for (int i=1; i<args.length; i++) {
if (args[i] > maximum) {
maximum = args[i];
return maximum;
new ESieve(maximum);
for(int i=0; i<args.length; i++)
Prime(i);}I've made changes and now my code looks like this:
public class ESieve {
ESieve(int n) {
sieve(n);
public static boolean sieve(int n)
boolean[] s = new boolean[n+1];
for (int i=2; i<=n; i++)
s=true;
for(int i=2;i*i<n;i++){
if(s[i]){
for(int j=i;i*j<=n;j++){
s[i*j]=false;}}}
return s[n];}
public static boolean prime(int m)
if (m<2) return false;
boolean x = sieve(m);
if (x=true)
System.out.println (m + " is prime");
else
System.out.println (m + " is not prime");
return x;}
//main
public class ESieveTest{
public static int max(int[] args) {
int maximum = args[0];
for (int i=1; i<args.length; i++) {
if (args[i] > maximum) {
maximum = args[i];
return maximum;
public static void main (String[] args)
int n; int i, j;
for(i=0;i<=args.length;i++)
n=Integer.parseInt(args[i]);
int maximum=max(args[]);
ESieve S = new ESieve(maximum);
for(i=0; i<args.length; i++)
S.prime(i);}
It shows an error for main:
{quote} ESieveTest.java:21: '.class' expected
int maximum=max(args[]); {quote}
Any suggestions how to fix it? -
Problem with return a ColdFusion query object from a Java class
Hi!
I need to return a ColdFusion query object from a Java class
using a JDBC result set ( java.sql.ResultSet);
I have tried to pass my JDBC result set in to the constructor
of the coldfusion.sql.QueryTable class with this code:
ColdFusion code
<cfset pra = createObject("java","QueryUtil").init()>
<cfset newQuery = CreateObject("java",
"coldfusion.sql.QueryTable")>
<cfset newQuery.init( pra.getColdFusionQuery () ) >
My java class execute a query to db and return QueryTable
Java code (QueryUtil.java)
import coldfusion.sql.QueryTable; // (CFusion.jar for class
QueryTable)
import com.allaire.cfx //(cfx.jar for class Query used from
QueryTable)
public class QueryUtil
public static coldfusion.sql.QueryTable
getColdFusionQuery(java.sql.ResultSet rs)
return new coldfusion.sql.QueryTable(rs);
but when i run cfm page and coldfusion server tries to
execute : "<cfset pra =
createObject("java","QueryUtil").init()>" this error appears:
Object Instantiation Exception.
An exception occurred when instantiating a java object. The
cause of this exception was that: coldfusion/sql/QueryTable.
If i try to execute QueryUtil.java with Eclipse all it works.
Also I have tried to return java.sql.ResultSet directly to
coldfusion.sql.QueryTable.init () with failure.
Do you know some other solution?ok
i print all my code
pratica.java execute a query to db and return a querytable
java class
import java.util.*;
import java.sql.*;
import coldfusion.sql.*;
public class Pratica {
private HashMap my;
private String URI,LOGIN,PWD,DRIVER;
private Connection conn=null;
//funzione init
//riceve due strutture converite in hashmap
// globals
// dbprop
public Pratica(HashMap globals,HashMap dbprop) {
my = new HashMap();
my.put("GLOBALS",globals);
my.put("DBPROP",dbprop);
URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
LOGIN = "usr_dev";
PWD = "developer";
DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
try{
// Carico il driver JDBC per la connessione con il database
MySQL
Class.forName(DRIVER);
/* Connessione alla base di dati */
conn=DriverManager.getConnection(URI,LOGIN,PWD);
if(conn!=null) System.out.println("Connection Successful!");
} catch (ClassNotFoundException e) {
// Could not find the database driver
System.out.print("\ndriver non trovato "+e.getMessage());
System.out.flush();
catch (SQLException e) {
// Could not connect to the database
System.out.print("\nConnessione fallita "+e.getMessage());
System.out.flush();
//funzione search
//riceve un hash map con i filtri di ricerca
public QueryTable search(/*HashMap arg*/) {
ResultSet rs=null;
Statement stmt=null;
QueryTable ret=null;
String query="SELECT * FROM TAN100pratiche";
try{
stmt = conn.createStatement();// Creo lo Statement per
l'esecuzione della query
rs=stmt.executeQuery(query);
// while (rs.next()) {
// System.out.println(rs.getString("descrizione"));
catch (Exception e) {
e.printStackTrace();
try {
ret = Pratica.RsToQueryTable(rs);
} catch (SQLException e) {
e.printStackTrace();
this.close();
return(ret);
// ret=this.RsToQuery(rs);
// this.close(); //chiude le connessioni,recordset e
statament
//retstruct CF vede HashMap come struct
//METODO DI TEST
public HashMap retstruct(){
return(my);
//conversione resultset to querytable
private static QueryTable RsToQueryTable(ResultSet rs)
throws SQLException{
return new QueryTable(rs);
//chiura resultset statament e connessione
private void close(){
try{
conn.close();
conn=null;
catch (Exception e) {
e.printStackTrace();
coldfusion code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<title>Test JDBC CFML Using CFScript</title>
</head>
<body>
<cftry>
<cfset glb_map =
createObject("java","java.util.HashMap")>
<cfset dbprop_map =
createObject("java","java.util.HashMap")>
<cfset glb_map.init(glb)> <!---are passed from
another page--->
<cfset dbprop_map.init(glb["DBPROP"])>
<cfset pra =
createObject("java","Pratica").init(glb_map,dbprop_map)>
<cfset ourQuery
=createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
<cfcatch>
<h2>Error - info below</h2>
<cfdump var="#cfcatch#"><cfabort>
</cfcatch>
</cftry>
<h2>Success - statement dumped below</h2>
<cfdump var="#ourQuery#">
</body>
</html>
error at line <cfset pra =
createObject("java","Pratica").init(glb_map,dbprop_map)>
An exception occurred when instantiating a java object. The
cause of this exception was that: coldfusion/sql/QueryTable.
-----------------------------------------------------------------------
Maybe you are looking for
-
Logical Profiles in ISE 1.2
I created a logical profiles group that is assigned with the Apple-ipad, Apple-iPhone and Apple-iDevice policies. Now ISE will not update the feed policies for the three devices. This is the message that I recieved from ISE when it does it Feed Polic
-
Display infopath form in listview, select item to populate the form
Hi- I once used a list where if you selected the list item by clicking a <-> button,it then populated the infopath form on that page. I have a page with two webpart zones, one for the list and one for the related infopath form. How can i connect the
-
Lion Terminal Application key sequence "cntl-shift-E-c-." doesn't work???
This key sequence "control shift E c ." terminates my Linux console application session which used to control a second Linux session If I am unable to enter it, I must end the terminal window to end the console session The sequence worked on Snow Leo
-
Iphone 4s usb audio crackling and popping
hi my iphone 4s crackles and pops when listening to music using usb audio playback in my car my ipod is fine just the phone that does it anyone know of a fix ??
-
It is just my passing infomation to you just in case anybody need it. mine is 0572:cb00 in order for this to work with Archlinux I had to -copy from the debian tree : /usr/lib/pppd/2.4.4 directory to the archlinux : /usr/lib/pppd/ -copy the files cxa