Swing/AWT/SWT :: How To Use Data From Login Panel In Another Class

Aug 4, 2014

I am getting datas from user and checking it with database (MS SQL ) if it fits it is sweatching to new window. In new window I need to use again my database so I need to add connecting datas again. I would like to get them from login window. How to do that? I know theory but when I am writting code nothing works. Here is working code for login panel :

/*import java.awt.BorderLayout;
import javax.swing.*;
public class Login extends JFrame {
public String url;
public static void main(String[] args) {
Log frameTabel = new Log();

[Code] .....

View Replies


ADVERTISEMENT

How To Use Data From Login Panel In Another Class

Aug 4, 2014

I am getting data from user and checking it with database (MS SQL ) if it fits it is switching to new window. In new window I need to use again my database so I need to add connecting data again. I would like to get them from login window. How to do that? I know theory but when I am writing code nothing works. Here is working code for login panel :

/*import java.awt.BorderLayout;
import javax.swing.*;
public class Login extends JFrame {

[Code].....

View Replies View Related

Swing/AWT/SWT :: Panel From Nested Class Does Not Display

Sep 26, 2014

I have this panel in a nested class in the MainPanel class and it does not display, when I launch the applet, or more like, the two menus "LineColor" and "BackColor" from the nested class ColorPanel do not display .

This is the code:

package ui.panels;
import interfaces.Resettable;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.Panel;

[code].....

View Replies View Related

Swing/AWT/SWT :: When Click On Button From Bottom Panel Top Panel Need To Be Redrawn

Apr 1, 2014

When i click on the button from bottom panel, top panel need to be redrawn. But redrawing is not happening. It happens only when resizing the applet.

public class Graphics_Chart(){
public init(){
JScrollPane topPane = new JScrollPane(new ImagePanel2());
topPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
topPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

[code]...

View Replies View Related

Unable To Fetch Data Into Database After Login Page

May 27, 2014

[public class Login
{
private String username;
private String password;
private String login_time;
private String logout_time;
private String status;
private String late;

[Code]...

but i am getting an error as but i am getting an error as

java.lang.NoSuchMethodException: com.tribro.chandu.Login.post();

View Replies View Related

JSF :: SSO Class - How To Redirect To Login Page

Jul 20, 2014

I have write a SSO class for Single Sign on But i am getting one issue i am using JSF2 for my web application...here is my SSO class :

public class ApplicationSSO implements SSO {
public String authenticateUser(RequestContext request) {
UmUsersList user = (UmUsersList) request.getSessionContext().getAttribute("USER");
return user.getUmulEmailId();
}

[Code] .....

As you can see i have write below line

JSFUtils.redirectPage("../login/Login.xhtml");

It mean if User null it will redirect to Login page but it is not working. How to solve the issue i am end up with

An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

Error while executing SSO actions: java.lang.NullPointerException

View Replies View Related

Swing Login Form With MySQL

Feb 8, 2015

I'm trying to create a userlogin program using mysql. I have an error at line 70.

package userDatabasePack;
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class UserLogin {
public static void main (String[]args) throws SQLException{

[code]....

View Replies View Related

Login Form In 3 Tire Arch Using Swing With Pojo

Feb 26, 2014

I am new to java(beginner) and i am not aware of servlets, yet to learn i want a simple login app using swing in 3tire arch using pojos.

View Replies View Related

JPanel Class That Creates Left And Right Panel

Feb 12, 2015

I have a JPanel class that creates a left panel and a right panel. the left panel and right panel both have one button each. What I’m trying to accomplish is when I click on the button in the left panel that it updates the button in the right panel. I have to do this without changing anything in the right panel.Basically I have to have LeftPanel have a way to keep track of an instance of RightPanel and I would have to do this through the JPanel class. But I have no clue where to begin on even accomplishing this.

View Replies View Related

Swing/AWT/SWT :: Iterating Through Objects To Draw On Panel?

Apr 23, 2014

I currently have the code set up to iterate through objects and keep track of them but how do I do the same and draw the objects on the panel window? I'm confused on what to do and how to start it.

Here's the code I have so far, the 'Car' which I want to draw extends to another class which extends to GameObject. I currently have a 'draw()' method under the 'Car' class but nothing in the 'draw()' method yet. From what I understand i'm suppose to have a 'draw()' method under 'GameObjects' class also?

public class MapView extends JPanel implements IObserver, ActionListener{
JPanel myPanel;
private Timer timer = new Timer(5, this);
int x = 0;
int moveX = 2;
public MapView(){
super.setBorder(BorderFactory.createTitledBorder("Map:"));

[code]....

Mostly I don't understand how to go through the iterator again to paint the objects. Wouldn't I need to put another iterator under 'paintComponent()' or can it be done under 'update()' ?

how to get some shapes from the GameObjects onto my panel.

View Replies View Related

Swing/AWT/SWT :: Show Labels In A Panel With Scrolling

Oct 31, 2014

I've created a chat program, but now I need to show messages in different colors depending if the message is received or sent. I was wondering if I can use jlabel to do this but in this case I need that jlabels to scroll in a jpanel. how to do this or maybe using a rtf ?

View Replies View Related

Swing/AWT/SWT :: Panel Not Showing Added Components

Apr 27, 2014

My panel named panelIncomeInfo are not showing the components that I have added.

public class PayrollGUI {
private JPanel panelIncomeInfo = new JPanel ();
private JPanel panel = new JPanel ();
private JPanel panelPayCheckInfo = new JPanel ();
private JButton close = new JButton ("Close");

[Code] .....

View Replies View Related

Swing/AWT/SWT :: How To Change Background Color Of Panel

May 3, 2014

Program is not working. I want to use buttonPanel object in ColorAction class and the process is unknown to me .

package button;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonFrame extends JFrame
{
public JPanel buttonPanel;

[Code]...

View Replies View Related

Swing/AWT/SWT :: How To Make Expand / Collapsable Panel

Oct 29, 2005

Is it possible to make Expand/Collapsable panels in Java without writing huge amounts of code? I want something like this Expand/Collapse How would I go about it?

View Replies View Related

Swing/AWT/SWT :: Create A New PanelLogin In Main And Use Method To Get Panel

Feb 16, 2014

I have two classes: main (with JFrame) and a panelLogin class with a method returning a panel with all login components..so I create a new panelLogin in main and use the method to get the panel, put it into my JFrame. But here the problem: on the loginPanel the ActionListener for the login-event, if the input is correct,the panel shall disappear and the main panel shall appear.Should I make some kind of top class, which handels the panels?

View Replies View Related

Swing/AWT/SWT :: Give JTextArea Focus - Using It On A Panel And With JToolBar

Apr 21, 2014

I have a program with a main panel JPanel that implements KeyListener. I added a JTextArea to which I added as the KeyListener: this, meaning the main panel. I made the JTextArea fill the entire main panel because I want to catch a key press anywhere in the main panel.I catch the key presses and the program does what I want it to.

I added a JToolBar to the program; it is working just fine.Now that I have two components on the main panel - toolbar and panel with textarea -, the textarea must have the focus before it will send the KeyEvent and call keyPressed(). I don't want to expect the user to click on the main window to get the program to start or after each time they use the toolbar.

I have tried calling both requestFocus() and requestFocusInWindow() on the textarea; neither call worked. I put the toolbar at PAGE_END instead of PAGE_START; this worked to allow the program to start but I don't want to have the toolbar at the bottom and once I clicked on a toolbar button, the textarea lost the focus.

I need to be able to give the textarea the focus when the program starts and after the user uses a toolbar button. (I suspect that if I solve the problem when the program starts, I can use the same method after handling a button press.)

View Replies View Related

Swing/AWT/SWT :: Changing Panel In Jframe On Click Of A Button

Jun 22, 2014

I want to switch panel on click of a button and code for switching panels is written in update method (Which gets called from notify observer of another class as part of Observer pattern.

unoGameController.playGame(playerFirst.getText(), playerSecond.getText());

playGame in Panel 1 of class 1 calls another class (class 2)and data comes in update method of class 1(Observer interface).

Now for switching panels code is in gameControllerDataProcessing . I am not able to switch the panels when this functionality runs.

However if i dont call the unoGameController.playGame(playerFirst.getText(), playerSecond.getText() and directly call the update method or directly write the switching panel code . then it works fine.

btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if((!(playerFirst.getText().equalsIgnoreCase("") ||playerSecond.getText().equalsIgnoreCase(""))&&(!playerFirst.getText().equalsIgnoreCase(playerSecond.getText())) ) ){
unoGameController.playGame(playerFirst.getText(), playerSecond.getText());

[Code] .....

View Replies View Related

Swing/AWT/SWT :: How To Show And Hide Panel In One JButton Click Event

Nov 23, 2014

In JButton's click event, I wanto to show a JPanel to print the message "Processing" on the screen. Before JButton's click logic end, hide the JPanel.

Actually, JPanel is not displayed. I do not know why.When msgPanel .setVisible(false); is commented out, JPanel is normally displayed .But do not know how to hide it when JButton's click logic is finished.

Here is the code.

 loadBtn.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {
   JPanel msgPanel = new JPanel(rootFrame);
   // Show the message JPanel

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Reading Point Objects From DRW File And Drawing Lines On Panel

Sep 15, 2014

I am trying to read Point objects from .drw file which contains endpoints of line segments, and draw lines making a square on panel when I run the program. This is what I have got so far. how to get the points using array for drawing ?

// inside the method to read points objects from .drw file
try {
fos = new FileInputStream("square.drw");
oos = new ObjectInputStream(fos);
// creating an object of Point class
endPoints = new Point[sampleSize];

[code]...

View Replies View Related

Connect Four Game With Java Swing / Make Multi D Panel Maker When Try To Run It

May 31, 2014

I am trying to make a Connect Four game with java swing, but I am getting an error with my attempt at making an multi D panel maker when I try to run it.

import javax.swing.*;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
 
[code]...

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

How To Switch From One Panel To Another Panel

Apr 5, 2014

I have two(panel1 and panel2) panels in a jframe,all three of them are different classes .

In jframe there is a display panel on which the panel1 and panel2 are called and displayed.

now i have a button in panel1 .i want that when i will click on that button panel2 will be displayed or added to the dispalypanel of jframe.

View Replies View Related

Getting Objects Data In Class

Mar 7, 2015

I have a class which connects with database and fills object with data. Method looks like this:

//in database class
void getData(anObject a, int id){
//connects with database
a.field1=get...
a.field2=get...
....
//disconnects
}

Now I want to use this method in anObject class, but I can't call it because I don't have created object jet. Is there any way to call this method?

View Replies View Related

Storing Data Of Particular Class In Files

Jul 29, 2014

I need to store the data of a bunch of objects of a particular class in files in a predefined directory. Later, I want to get all the files from the directory and turn them into the objects again. Ideally, I'd like to have one file per object and have the files be human-readable and editable without too much difficulty. The class used by the objects will likely be subject to change in the future, as well. To keep things simple, all the data members are either primitives, Strings, or arrays of them. What is the best library/API to use to deal with this situation? Or should I write my own classes for these operations?

I read into serialization, but I read that it doesn't deal well with classes that are frequently modified. I also found articles on Preferences, but none of the ones I saw seem to explain how to best handle reading and writing to and from multiple objects, especially when I don't know a prior all the objects that were written to disk.

View Replies View Related

How To Access Objects Data From Another Class

Oct 3, 2014

I've been unable to figure out how to access an objects data from another class. I ended up missing a lesson in java and haven't been able to catch up on this topic on my own through my textbook.

Error: has private access

Code:

public class TestCoffeeDrinker {
public static void main(String[] args) {
Coffee latte = new Coffee("Starbucks Tall Latte", 2.85);
Coffee mocha = new Coffee("Starbucks Grande Mocha", 3.95);
Coffee mcdonalds = new Coffee("McDonalds McCafe", 0.99);
System.out.println(mcdonalds.toString());

[Code]...

View Replies View Related

Using Accessor Methods To Access Data From Another Class

May 6, 2014

I have been asked to write a program with 3 classes(an interface, a store and a product class) and I have been going ok until I need to display data on the interface that is held in the product class. At the moment the code will compile fine but when I run the program and try to use the writeOutput() method I get a stack overflow error.

I realise now that it is because of a non-terminating recursive call, however I can not think of a solution on how to fix the problem. And just to clarify, what I am aiming to do is have the MatesTerminal class display the data for name that is stored in the Product class(I have no way of determining which product to display at this time, so I would like to be able to display the data for all three products if possible). Anyway this is what I have so far:

The method from the MatesTerminal Class:

private void writeOutput() {
int productChoice;
Scanner console = new Scanner(System.in);

[Code].....

View Replies View Related







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