Jlabel Help!!! αστερακια

Συζητήσεις για την Java

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
dimman24
Δημοσιεύσεις: 4
Εγγραφή: 11 Οκτ 2009 22:05

Jlabel Help!!! αστερακια

Δημοσίευση από dimman24 » 18 Δεκ 2009 18:06

Παιδια εχω τρελαθει!!! θελω σε ενα jlabel να εμφανιζω οταν γραφω "*"(=αστερακια...!)
προσπαθω με το ....SringvalueOF("*); αλλα δε ειναι αυτο...
Παρακαλω βοηθεια!!!

Άβαταρ μέλους
virxen75
Δημοσιεύσεις: 493
Εγγραφή: 18 Φεβ 2009 00:17
Τοποθεσία: ΗΡΑΚΛΕΙΟ ΚΡΗΤΗΣ

Jlabel Help!!! αστερακια

Δημοσίευση από virxen75 » 18 Δεκ 2009 18:28

σίγουρα jlabel?

στείλε τον κώδικα να δω τι προσπαθείς να κάνεις

dimman24
Δημοσιεύσεις: 4
Εγγραφή: 11 Οκτ 2009 22:05

Jlabel Help!!! αστερακια

Δημοσίευση από dimman24 » 20 Δεκ 2009 10:20

virxen75 έγραψε:σίγουρα jlabel?

στείλε τον κώδικα να δω τι προσπαθείς να κάνεις

Aytos einai .....








/*
* To change this t

@Override
public int getWidth(ImageObserver observer) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getHeight(ImageObserver observer) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public ImageProducer getSource() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Graphics getGraphics() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Object getProperty(String name, ImageObserver observer) {
throw new UnsupportedOperationException("Not supported yet.");
}
}mplate, choose Tools | Templates
* and open the template in the editor.
*/

/*
* ATMFrame.java
*
* Created on 6 Δεκ 2009, 5:07:01 μμ
*/
package sphy.atm;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.LayoutManager;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
*
* @author SIANAS
*/
public class ATMFrame extends javax.swing.JFrame {

private JPanel current;
private StringBuilder charBuffer = new StringBuilder();
private Account account;
private AccountManager manager;
private char[] numbers = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

/** Creates new form ATMFrame */
public ATMFrame() {
initComponents();
manager = new FileAccountManager();
setIconImage(Toolkit.getDefaultToolkit().getImage(ATMFrame.class.getResource("/sphy/atm/resources/Currency Euro.png")));
current = loginPanel;
FrameActionListener fal = new FrameActionListener();
this.addKeyListener(fal);
oneButton.addActionListener(fal);
twoButton.addActionListener(fal);
threeButton.addActionListener(fal);
fourButton.addActionListener(fal);
fiveButton.addActionListener(fal);
sixButton.addActionListener(fal);
sevenButton.addActionListener(fal);
eightButton.addActionListener(fal);
nineButton.addActionListener(fal);
zeroButton.addActionListener(fal);
enterButton.addActionListener(fal);
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

topPanel = new javax.swing.JPanel();
loginPanel = new javax.swing.JPanel();
loginInfoLabel = new javax.swing.JLabel();
pinLabel = new javax.swing.JLabel();
pinInputLabel = new javax.swing.JLabel();
mainPanel = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
balancePanel = new javax.swing.JPanel();
balanceLabel = new javax.swing.JLabel();
balanceBackLabel = new javax.swing.JLabel();
balanceExitLabel = new javax.swing.JLabel();
depositPanel = new javax.swing.JPanel();
depositInfoLabel = new javax.swing.JLabel();
depositAmountLabel = new javax.swing.JLabel();
depositAmountEditLabel = new javax.swing.JLabel();
withdrawalPanel = new javax.swing.JPanel();
oneHundredLabel = new javax.swing.JLabel();
oneHundredLabel1 = new javax.swing.JLabel();
oneHundredLabel2 = new javax.swing.JLabel();
oneHundredLabel3 = new javax.swing.JLabel();
oneHundredLabel4 = new javax.swing.JLabel();
oneHundredLabel5 = new javax.swing.JLabel();
oneHundredLabel6 = new javax.swing.JLabel();
oneHundredLabel7 = new javax.swing.JLabel();
bottomPanel = new javax.swing.JPanel();
keyPanel = new javax.swing.JPanel();
enterButton = new javax.swing.JButton();
oneButton = new javax.swing.JButton();
zeroButton = new javax.swing.JButton();
twoButton = new javax.swing.JButton();
threeButton = new javax.swing.JButton();
fourButton = new javax.swing.JButton();
fiveButton = new javax.swing.JButton();
sixButton = new javax.swing.JButton();
sevenButton = new javax.swing.JButton();
eightButton = new javax.swing.JButton();
nineButton = new javax.swing.JButton();
outputPanel = new javax.swing.JPanel();
takeMoneyLabel = new javax.swing.JLabel();
giveMoneyLabel = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("ATM");

topPanel.setName("lola"); // NOI18N
topPanel.setLayout(new java.awt.CardLayout());

loginPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Είσοδος"));

loginInfoLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
loginInfoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
loginInfoLabel.setText("Παρακαλώ εισάγετε το PIN και πατήστε Enter");

pinLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
pinLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
pinLabel.setText("PIN:");

pinInputLabel.setBackground(new java.awt.Color(255, 255, 255));
pinInputLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
pinInputLabel.setForeground(new java.awt.Color(0, 51, 255));

javax.swing.GroupLayout loginPanelLayout = new javax.swing.GroupLayout(loginPanel);
loginPanel.setLayout(loginPanelLayout);
loginPanelLayout.setHorizontalGroup(
loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loginPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(loginInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addGroup(loginPanelLayout.createSequentialGroup()
.addComponent(pinLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pinInputLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)))
.addContainerGap())
);
loginPanelLayout.setVerticalGroup(
loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loginPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(loginInfoLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pinLabel)
.addComponent(pinInputLabel))
.addContainerGap(124, Short.MAX_VALUE))
);

loginPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {pinInputLabel, pinLabel});

topPanel.add(loginPanel, "login");

mainPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Καλώς Ήρθατε"));

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("1 - Ερώτηση Υπολοίπου");

jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("2 - Ανάληψη ");

jLabel4.setFont(new java.awt.Font("Tahoma", 0, 18));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("3 - Κατάθεση ");

jLabel5.setFont(new java.awt.Font("Tahoma", 0, 18));
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel5.setText("4 - Έξοδος ");

javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE))
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addContainerGap(68, Short.MAX_VALUE))
);

topPanel.add(mainPanel, "main");

balancePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Υπόλοιπο"));

balanceLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
balanceLabel.setForeground(new java.awt.Color(0, 0, 204));
balanceLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
balanceLabel.setText("Έχετε υπόλοιπο: €");

balanceBackLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
balanceBackLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
balanceBackLabel.setText("1 - Άλλη Συναλλαγή");

balanceExitLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
balanceExitLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
balanceExitLabel.setText("2 - Έξοδος ");

javax.swing.GroupLayout balancePanelLayout = new javax.swing.GroupLayout(balancePanel);
balancePanel.setLayout(balancePanelLayout);
balancePanelLayout.setHorizontalGroup(
balancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(balancePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(balancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(balanceLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addComponent(balanceBackLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)
.addComponent(balanceExitLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE))
.addContainerGap())
);
balancePanelLayout.setVerticalGroup(
balancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(balancePanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(balanceLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(balanceBackLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(balanceExitLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);

topPanel.add(balancePanel, "balance");

depositPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Κατάθεση"));

depositInfoLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
depositInfoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
depositInfoLabel.setText("Πληκτρολογίστε το ποσό της κατάθεσης και πατήστε Enter");

depositAmountLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
depositAmountLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
depositAmountLabel.setText("Ποσό:");

depositAmountEditLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
depositAmountEditLabel.setForeground(new java.awt.Color(0, 0, 153));

javax.swing.GroupLayout depositPanelLayout = new javax.swing.GroupLayout(depositPanel);
depositPanel.setLayout(depositPanelLayout);
depositPanelLayout.setHorizontalGroup(
depositPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(depositPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(depositPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(depositPanelLayout.createSequentialGroup()
.addComponent(depositAmountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(depositAmountEditLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE))
.addComponent(depositInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE))
.addContainerGap())
);
depositPanelLayout.setVerticalGroup(
depositPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(depositPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(depositInfoLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(depositPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(depositAmountLabel)
.addComponent(depositAmountEditLabel))
.addContainerGap(124, Short.MAX_VALUE))
);

depositPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {depositAmountEditLabel, depositAmountLabel});

topPanel.add(depositPanel, "deposit");

withdrawalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Ανάλυψη"));

oneHundredLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel.setText("1 - 100 €");

oneHundredLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel1.setText("2 - 200 €");

oneHundredLabel2.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel2.setText("3 - 300 €");

oneHundredLabel3.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel3.setText("4 - 400 €");

oneHundredLabel4.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel4.setText("5 - 500 € ");

oneHundredLabel5.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel5.setText("6 - 600 € ");

oneHundredLabel6.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel6.setText("7 - Άλλο Ποσό");

oneHundredLabel7.setFont(new java.awt.Font("Tahoma", 0, 18));
oneHundredLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
oneHundredLabel7.setText("8 - Έξοδος ");

javax.swing.GroupLayout withdrawalPanelLayout = new javax.swing.GroupLayout(withdrawalPanel);
withdrawalPanel.setLayout(withdrawalPanelLayout);
withdrawalPanelLayout.setHorizontalGroup(
withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(oneHundredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(oneHundredLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE))
.addComponent(oneHundredLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(oneHundredLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(oneHundredLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
.addComponent(oneHundredLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
.addComponent(oneHundredLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
.addComponent(oneHundredLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE))
.addContainerGap())
);
withdrawalPanelLayout.setVerticalGroup(
withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createSequentialGroup()
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(oneHundredLabel4)
.addComponent(oneHundredLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createSequentialGroup()
.addComponent(oneHundredLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(withdrawalPanelLayout.createSequentialGroup()
.addComponent(oneHundredLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(withdrawalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(oneHundredLabel7)
.addComponent(oneHundredLabel3)))
.addComponent(oneHundredLabel2)))
.addComponent(oneHundredLabel1)))
.addComponent(oneHundredLabel))
.addContainerGap(68, Short.MAX_VALUE))
);

topPanel.add(withdrawalPanel, "withdrawal");

keyPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Πληκτρολόγιο"));

enterButton.setFont(new java.awt.Font("Tahoma", 1, 24));
enterButton.setForeground(new java.awt.Color(102, 102, 102));
enterButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/enters.png"))); // NOI18N
enterButton.setActionCommand("e");
enterButton.setBorderPainted(false);
enterButton.setContentAreaFilled(false);
enterButton.setFocusPainted(false);
enterButton.setFocusable(false);
enterButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/enter.png"))); // NOI18N
enterButton.setRequestFocusEnabled(false);
enterButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/enterss.png"))); // NOI18N

oneButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/1s.png"))); // NOI18N
oneButton.setActionCommand("1");
oneButton.setBorder(null);
oneButton.setContentAreaFilled(false);
oneButton.setFocusPainted(false);
oneButton.setFocusable(false);
oneButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/1.png"))); // NOI18N
oneButton.setRequestFocusEnabled(false);
oneButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/1ss.png"))); // NOI18N

zeroButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/0s.png"))); // NOI18N
zeroButton.setActionCommand("0");
zeroButton.setBorderPainted(false);
zeroButton.setContentAreaFilled(false);
zeroButton.setFocusPainted(false);
zeroButton.setFocusable(false);
zeroButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/0.png"))); // NOI18N
zeroButton.setRequestFocusEnabled(false);
zeroButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/0ss.png"))); // NOI18N

twoButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/2s.png"))); // NOI18N
twoButton.setActionCommand("2");
twoButton.setBorder(null);
twoButton.setContentAreaFilled(false);
twoButton.setFocusPainted(false);
twoButton.setFocusable(false);
twoButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/2.png"))); // NOI18N
twoButton.setRequestFocusEnabled(false);
twoButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/2ss.png"))); // NOI18N

threeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/3s.png"))); // NOI18N
threeButton.setActionCommand("3");
threeButton.setBorder(null);
threeButton.setContentAreaFilled(false);
threeButton.setFocusPainted(false);
threeButton.setFocusable(false);
threeButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/3.png"))); // NOI18N
threeButton.setRequestFocusEnabled(false);
threeButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/3ss.png"))); // NOI18N

fourButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/4s.png"))); // NOI18N
fourButton.setActionCommand("4");
fourButton.setBorder(null);
fourButton.setContentAreaFilled(false);
fourButton.setFocusPainted(false);
fourButton.setFocusable(false);
fourButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/4.png"))); // NOI18N
fourButton.setRequestFocusEnabled(false);
fourButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/4ss.png"))); // NOI18N

fiveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/5s.png"))); // NOI18N
fiveButton.setActionCommand("5");
fiveButton.setBorder(null);
fiveButton.setContentAreaFilled(false);
fiveButton.setFocusPainted(false);
fiveButton.setFocusable(false);
fiveButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/5.png"))); // NOI18N
fiveButton.setRequestFocusEnabled(false);
fiveButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/5ss.png"))); // NOI18N

sixButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/6s.png"))); // NOI18N
sixButton.setActionCommand("6");
sixButton.setBorder(null);
sixButton.setContentAreaFilled(false);
sixButton.setFocusPainted(false);
sixButton.setFocusable(false);
sixButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/6.png"))); // NOI18N
sixButton.setRequestFocusEnabled(false);
sixButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/6ss.png"))); // NOI18N

sevenButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/7s.png"))); // NOI18N
sevenButton.setActionCommand("7");
sevenButton.setBorder(null);
sevenButton.setContentAreaFilled(false);
sevenButton.setFocusPainted(false);
sevenButton.setFocusable(false);
sevenButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/7.png"))); // NOI18N
sevenButton.setRequestFocusEnabled(false);
sevenButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/7ss.png"))); // NOI18N

eightButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/8s.png"))); // NOI18N
eightButton.setActionCommand("8");
eightButton.setBorder(null);
eightButton.setContentAreaFilled(false);
eightButton.setFocusPainted(false);
eightButton.setFocusable(false);
eightButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/8.png"))); // NOI18N
eightButton.setRequestFocusEnabled(false);
eightButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/8ss.png"))); // NOI18N

nineButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/9s.png"))); // NOI18N
nineButton.setActionCommand("9");
nineButton.setBorder(null);
nineButton.setContentAreaFilled(false);
nineButton.setFocusPainted(false);
nineButton.setFocusable(false);
nineButton.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/9.png"))); // NOI18N
nineButton.setRequestFocusEnabled(false);
nineButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/9ss.png"))); // NOI18N

javax.swing.GroupLayout keyPanelLayout = new javax.swing.GroupLayout(keyPanel);
keyPanel.setLayout(keyPanelLayout);
keyPanelLayout.setHorizontalGroup(
keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(keyPanelLayout.createSequentialGroup()
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(keyPanelLayout.createSequentialGroup()
.addComponent(oneButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(twoButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(threeButton))
.addGroup(keyPanelLayout.createSequentialGroup()
.addComponent(fourButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fiveButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sixButton))
.addGroup(keyPanelLayout.createSequentialGroup()
.addComponent(sevenButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(eightButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nineButton))
.addGroup(keyPanelLayout.createSequentialGroup()
.addComponent(zeroButton, 0, 0, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enterButton, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);

keyPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {oneButton, zeroButton});

keyPanelLayout.setVerticalGroup(
keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(keyPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(threeButton)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(twoButton, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(oneButton)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(sixButton)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fiveButton, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(fourButton)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(nineButton)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(eightButton, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(sevenButton)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(keyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(enterButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, Short.MAX_VALUE)
.addComponent(zeroButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, Short.MAX_VALUE))
.addGap(19, 19, 19))
);

keyPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {oneButton, zeroButton});

outputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Είσοδος/Έξοδος Χρημάτων"));

takeMoneyLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
takeMoneyLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
takeMoneyLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/Arrow1 Down.png"))); // NOI18N
takeMoneyLabel.setText("Πάρτε τα χρήματά σας από εδώ");
takeMoneyLabel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

giveMoneyLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
giveMoneyLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
giveMoneyLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphy/atm/resources/Arrow1 Up.png"))); // NOI18N
giveMoneyLabel.setText("Τοποθετήστε το φάκελο με τα χρήματα εδώ");
giveMoneyLabel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

javax.swing.GroupLayout outputPanelLayout = new javax.swing.GroupLayout(outputPanel);
outputPanel.setLayout(outputPanelLayout);
outputPanelLayout.setHorizontalGroup(
outputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, outputPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(outputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(giveMoneyLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
.addComponent(takeMoneyLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE))
.addContainerGap())
);
outputPanelLayout.setVerticalGroup(
outputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(outputPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(takeMoneyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(giveMoneyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(29, Short.MAX_VALUE))
);

outputPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {giveMoneyLabel, takeMoneyLabel});

javax.swing.GroupLayout bottomPanelLayout = new javax.swing.GroupLayout(bottomPanel);
bottomPanel.setLayout(bottomPanelLayout);
bottomPanelLayout.setHorizontalGroup(
bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(bottomPanelLayout.createSequentialGroup()
.addComponent(keyPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(outputPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
bottomPanelLayout.setVerticalGroup(
bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(bottomPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(keyPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(outputPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(topPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
.addComponent(bottomPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bottomPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);

pack();
}// </editor-fold>

void actionHandler(char c) {

System.out.println(c);

if (current == loginPanel) {

String pin = charBuffer.toString();

if (c == 'e') {
account = manager.login(Integer.parseInt(pin));
if (account != null) {
switchPanel("main");
current = mainPanel;
} else {
JOptionPane.showMessageDialog(this, "Λάθος PIN.");
}
charBuffer = new StringBuilder();//clear char buffer
} else {

if (Arrays.binarySearch(numbers, c) >= 0) {
charBuffer.append(c);
if (charBuffer.length() > 4) {
charBuffer = new StringBuilder();//clear char buffer
pinInputLabel.setText(charBuffer.toString());
JOptionPane.showMessageDialog(this, "Το PIN είναι πολύ μεγάλο.");
}
}
}
pinInputLabel.setText(charBuffer.toString(String.valueOf(\u25cf)));



} else if (current == mainPanel) {
if (c == '1') {
balanceLabel.setText("Έχετε υπόλοιπο: " + account.viewBalance() + " €");
switchPanel("balance");
current = balancePanel;
} else if (c == '2') {
switchPanel("withdrawal");
current = withdrawalPanel;
} else if (c == '3') {
switchPanel("deposit");
current = depositPanel;
} else if (c == '4') {
System.exit(0);
}
} else if (current == balancePanel) {
if (c == '1') {
switchPanel("main");
current = mainPanel;
} else if (c == '2') {
System.exit(0);
}
} else if (current == withdrawalPanel) {
if (c == '8') {
System.exit(0);
} else if (c == '7') {
String input = JOptionPane.showInputDialog("Δώστε Ποσό.");
try {
double amount = Double.parseDouble(input);
if (account.checkAcount(amount)) {
account.withdraw(amount);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
} catch (NumberFormatException ex) {
Logger.getLogger(ATMFrame.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (c == '1') {
if (account.checkAcount(100d)) {
account.withdraw(100d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}else if (c == '2') {
if (account.checkAcount(200d)) {
account.withdraw(200d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}else if (c == '3') {
if (account.checkAcount(300d)) {
account.withdraw(300d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}else if (c == '4') {
if (account.checkAcount(400d)) {
account.withdraw(400d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}else if (c == '5') {
if (account.checkAcount(500d)) {
account.withdraw(500d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}else if (c == '6') {
if (account.checkAcount(600d)) {
account.withdraw(600d);
manager.saveAccount(account);
takeMoneyLabel.setForeground(Color.red);
} else {
JOptionPane.showMessageDialog(this, "Δεν έχετε αρκετά χρήματα.");
}
}
} else if (current == depositPanel) {
String samount = charBuffer.toString();
if (c == 'e') {
try {
double amount = Double.parseDouble(samount);
account.deposit(amount);
manager.saveAccount(account);
giveMoneyLabel.setForeground(Color.red);
charBuffer = new StringBuilder();//clear char buffer
} catch (NumberFormatException ex) {
Logger.getLogger(ATMFrame.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
if (Arrays.binarySearch(numbers, c) >= 0) {
charBuffer.append(c);
depositAmountEditLabel.setText(charBuffer.toString() + " €");
}
}
}
}

private void switchPanel(String panelName) {
LayoutManager lm = topPanel.getLayout();
if (lm instanceof CardLayout) {
CardLayout cl = (CardLayout) lm;
cl.show(topPanel, panelName);
}
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
// Get the native look and feel class name
String nativeLF = UIManager.getSystemLookAndFeelClassName();
// Install the look and feel

try {
UIManager.setLookAndFeel(nativeLF);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {
ATMFrame frame = new ATMFrame();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}

/**
* A class for capturing key event and button action events
*/
class FrameActionListener extends KeyAdapter implements ActionListener {

public void actionPerformed(ActionEvent e) {
String com = e.getActionCommand();
actionHandler(com.charAt(0));
}

@Override
public void keyPressed(KeyEvent e) {
super.keyTyped(e);
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
actionHandler('e');

} else {
actionHandler(e.getKeyChar());

}
}
}
// Variables declaration - do not modify
private javax.swing.JLabel balanceBackLabel;
private javax.swing.JLabel balanceExitLabel;
private javax.swing.JLabel balanceLabel;
private javax.swing.JPanel balancePanel;
private javax.swing.JPanel bottomPanel;
private javax.swing.JLabel depositAmountEditLabel;
private javax.swing.JLabel depositAmountLabel;
private javax.swing.JLabel depositInfoLabel;
private javax.swing.JPanel depositPanel;
private javax.swing.JButton eightButton;
private javax.swing.JButton enterButton;
private javax.swing.JButton fiveButton;
private javax.swing.JButton fourButton;
private javax.swing.JLabel giveMoneyLabel;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel keyPanel;
private javax.swing.JLabel loginInfoLabel;
private javax.swing.JPanel loginPanel;
private javax.swing.JPanel mainPanel;
private javax.swing.JButton nineButton;
private javax.swing.JButton oneButton;
private javax.swing.JLabel oneHundredLabel;
private javax.swing.JLabel oneHundredLabel1;
private javax.swing.JLabel oneHundredLabel2;
private javax.swing.JLabel oneHundredLabel3;
private javax.swing.JLabel oneHundredLabel4;
private javax.swing.JLabel oneHundredLabel5;
private javax.swing.JLabel oneHundredLabel6;
private javax.swing.JLabel oneHundredLabel7;
private javax.swing.JPanel outputPanel;
private javax.swing.JLabel pinInputLabel;
private javax.swing.JLabel pinLabel;
private javax.swing.JButton sevenButton;
private javax.swing.JButton sixButton;
private javax.swing.JLabel takeMoneyLabel;
private javax.swing.JButton threeButton;
private javax.swing.JPanel topPanel;
private javax.swing.JButton twoButton;
private javax.swing.JPanel withdrawalPanel;
private javax.swing.JButton zeroButton;
// End of variables declaration
}

Άβαταρ μέλους
virxen75
Δημοσιεύσεις: 493
Εγγραφή: 18 Φεβ 2009 00:17
Τοποθεσία: ΗΡΑΚΛΕΙΟ ΚΡΗΤΗΣ

Jlabel Help!!! αστερακια

Δημοσίευση από virxen75 » 20 Δεκ 2009 17:04

αν κατάλαβα καλά
παγιδεύεις τους χαρακτήρες που προέρχονται από το πληκτρολόγιο
και θες να εμφανίζεται στο label σου * αντί του χαρακτήρα σωστά?

μία άλλη λύση είναι αυτή που ακολουθεί.
Αν σου κάνει αυτό που θες προσάρμοσε την στις ανάγκες σου.

Κώδικας: Επιλογή όλων


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class LoginExample extends JFrame&#123;
	private JLabel label_loginname;
	private JTextField loginname;
	private JLabel label_password ;
	private JPasswordField password	;
	private	JButton btnLogin;	
		
	public LoginExample&#40;&#41;&#123;
    label_loginname = new JLabel&#40;"Enter your login name&#58;"&#41;;
    loginname = new JTextField&#40;15&#41;;
    label_password = new JLabel&#40;"Enter your password&#58;"&#41;;
    password = new JPasswordField&#40;&#41;;
    password.setEchoChar&#40;'*'&#41;;
    btnLogin=new JButton&#40;"LOGIN"&#41;;
    JPanel jp1=new JPanel&#40;&#41;;
    jp1.setLayout&#40;new GridLayout&#40;3,2,5,5&#41;&#41;;
    jp1.add&#40;label_loginname&#41;;
    jp1.add&#40;loginname&#41;;
    jp1.add&#40;label_password&#41;;
    jp1.add&#40;password&#41;;
    jp1.add&#40;btnLogin&#41;;
    JPanel jp2=new JPanel&#40;&#41;;
    jp2.add&#40;jp1&#41;;
    
    add&#40;jp2&#41;;
    btnLogin.addActionListener&#40;new ActionListener&#40;&#41;&#123;
    	public void actionPerformed&#40;ActionEvent e&#41;&#123;
    		String pass=password.getText&#40;&#41;;
    		if &#40;!pass.equals&#40;"1975"&#41;&#41; &#123;
    			JOptionPane.showMessageDialog&#40;null,"wrong password!!!&#40;hint try 1975 as password!!&#41;"&#41;;
    			password.setText&#40;""&#41;;
    		&#125;else&#123;
    			JOptionPane.showMessageDialog&#40;null,"login granted"&#41;;
    		&#125;
    	&#125;
    &#125;&#41;;
    setDefaultCloseOperation&#40;EXIT_ON_CLOSE&#41;;
    setSize&#40;400,200&#41;;
    setVisible&#40;true&#41;;
	&#125;
	public static void main&#40;String args&#91;&#93;&#41;&#123;
		new LoginExample&#40;&#41;;
	&#125;
&#125;


Απάντηση

Επιστροφή στο “Java”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες