Hey I'm a little new here so my apologies if I messed something up in my post. Anyways the problem I'm having has to deal with arrays, what I'm trying to do basically is use the String[] arrays to populate my form and display it on screen and then have the getForm() function return a String[] with the title of the form and the info in text[i]. This all works fine until I use use the button I added to call the getForm() function and I change to a different form (createForm() attached to ListListener) and all the labels appear as whatever was returned in the getForm() function. I'm pretty sure it has something to do with the way I'm using my arrays but I thought they would be set back to normal after I chose another list item which goes through the createForm() function again resetting the arrays, so I'm not sure whats going on.
Thanks
I've included a screenshot of what I'm referring too bellow as well.
http://www.majhost.com/gallery/adc90/afsd/error.png
class Form extends JPanel
{
//Arrays for the forms
private String[] com = {"Communication","ICAO","Type","Frequency"};
private String[] fuel = {"Fuel","ICAO","Type"};
private String[] runway = {"Runway","ICAO","Number","Type","Length"};
private String[] airplane = {"Airplane","Make","Model","Type","Fuel Capacity", "Fuel Burn Rate", "Air Speed"};
private String[] airport = {"Airplane","ICAO","Name","Longitude","Latitude","crFreq","crType", "Fuel Type"};
//Declare variables
private JTextField[] text;
private String[] formReturn;
private String[] formArray;
private JButton submit,clear;
public Form()
{
createForm("Airplane");
}
public void createForm(String choice)
{
removeAll();
if(choice.equals("Communication"))
{
formArray = com;
}
else if(choice.equals("Fuel"))
{
formArray = fuel;
}
else if(choice.equals("Airplane"))
{
formArray = airplane;
}
else if(choice.equals("Airport"))
{
formArray = airport;
}
else if(choice.equals("Runway"))
{
formArray = runway;
}
int l = formArray.length + 1;
text = new JTextField[l];
//Layout info
GridLayout grid = new GridLayout(l,2);
grid.setHgap(0);
setLayout(grid);
//Set label
add(new JLabel(formArray[0]));
add(new JLabel(""));
for(int i = 1; i < formArray.length; ++i)
{
add(new JLabel(formArray[i]));
add(text[i] = new JTextField(20));
}
//Add in the buttons and the actionlisteners
submit = new JButton("Create");
clear = new JButton("Delete");
add(clear);
clear.addActionListener(new Button());
add(submit);
submit.addActionListener(new Button());
updateUI();
}
//Get form info
//This works so far
public String[] getForm()
{
formReturn = formArray;
formReturn[0] = formArray[0];
for(int i = 1; i < formReturn.length; i++)
formReturn[i] = text[i].getText();
return formReturn;
}
//Clear form
public void clearForm()
{
for(int i = 1; i < formArray.length; i++)
text[i].setText("");
}
}
public String[] getForm()
{
formReturn = formArray; /* (0) */
formReturn[0] = formArray[0];
for(int i = 1; i < formReturn.length; i++)
formReturn[i] = text[i].getText(); /* (1) */
return formReturn;
}
Look at line (1): you modify formReturn array which points to labels text. formReturn -> formArray -> com.
To fix it just create new String array at (0):
formReturn = new String[formArray.length];
Related
I have a assignment that i had to create and array of buttons for a paint app project and everything is done but i am stuck on assigning/referencing/modifying my action listener.
The way it works(supposedly) is that i have a loop that creates, assigns a name, and adds to the action listener an Array of JButtons named myShapes. From this, I am supposed to have the actionlistener named listener(); give a int 1-6 to each jbutton, setting the current actionPerformed state.
int actionNum = 1;
ActionListener listener = new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
currentAction = actionNum;
}
};
//........................................................................
String[] myShapesName = {"brushBut", "lineBut", "ellipseBut", "rectBut", "strokeBut", "fillBut"};
//String[] myLisName = {"brushButL", "lineButL", "ellipseButL", "rectButL", "strokeButL", "fillButL"};
JButton[][] myShapes = new JButton[3][2];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
myShapes[i][j] = new JButton();
myShapes[i][j].setBounds(0, 0, 50, 50);//(100, 200);
myShapes[i][j].setName(myShapesName[i+j]);
myShapes[i][j].setBackground(null);
myShapes[i][j].putClientProperty("id",
String.valueOf(myShapesName[i+j]).concat(String.valueOf(j)));
MyShapesBox.add(myShapes[i][j]);
System.out.println(listener);
}
}
the problem is that i dont know how to change the actionlistener so that it gives all 6 Jbuttons a different actionPerformed state because each state represents a different brush. I tried several ways of like trying to make a Action list array and renaming them but that gives an error or breaks to loop which is needed for the assignment and ended with this final attempt. unfortunately, this currently is beyond me. If been on this for 2 days and Im stumped.
My first thought would be to create an action class, which took a int value as part of it's constructor, for simplicity sake, I'd make it a inner class, but you could use an outer class, but you'd need to pass more details to it, for example...
public class TestPane extends JPanel {
private int currenAction;
public TestPane() {
String[] myShapesName = {"brushBut", "lineBut", "ellipseBut", "rectBut", "strokeBut", "fillBut"};
//String[] myLisName = {"brushButL", "lineButL", "ellipseButL", "rectButL", "strokeButL", "fillButL"};
setLayout(new GridLayout(3, 2));
JButton[][] myShapes = new JButton[3][2];
int action = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
myShapes[i][j] = new JButton();
myShapes[i][j].setBounds(0, 0, 50, 50);//(100, 200);
myShapes[i][j].setName(myShapesName[i + j]);
myShapes[i][j].setBackground(null);
myShapes[i][j].putClientProperty("id",
String.valueOf(myShapesName[i + j]).concat(String.valueOf(j)));
myShapes[i][j].addActionListener(new ButtonAction(action));
action++;
add(myShapes[i][j]);
}
}
}
public class ButtonAction implements ActionListener {
private int actionNum;
public ButtonAction(int actionNum) {
this.actionNum = actionNum;
}
#Override
public void actionPerformed(ActionEvent arg0) {
currenAction = actionNum;
System.out.println(actionNum);
}
}
}
I am creating a dumb phone (like old traditional phone) and I'm using GUI programming. I need help with dialing the numbers. I don't know how to get the numbers to pop up on the display and stay there, and also use the delete button to delete the numbers that is up on the display too. I will post a youtube link so you can see a sample run.
I am currently stuck on passing the text from the button of each number that should display the number, however it's displaying the text of the button. I also, don't know how to keep the number there when other buttons are pressed without it being reset.
Here is my code:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.*;
public class DumbPhone extends JFrame
{
private static final long serialVersionUID = 1L;
private static final int WIDTH = 300;
private static final int HEIGHT = 500;
private static final String CALL_BUTTON_TEXT = "Call";
private static final String TEXT_BUTTON_TEXT = "Text";
private static final String DELETE_BUTTON_TEXT = "Delete";
private static final String CANCEL_BUTTON_TEXT = "Cancel";
private static final String SEND_BUTTON_TEXT = "Send";
private static final String END_BUTTON_TEXT = "End";
private static final String CALLING_DISPLAY_TEXT = "Calling...";
private static final String TEXT_DISPLAY_TEXT = "Enter text...";
private static final String ENTER_NUMBER_TEXT = "Enter a number...";
private JTextArea display;
private JButton topMiddleButton;
private JButton topLeftButton;
private JButton topRightButton;
private JButton[] numberButtons;
private JButton starButton;
private JButton poundButton;
private boolean isNumberMode = true;
private String lastPressed = "";
private int lastCharacterIndex = 0;
private Date lastPressTime;
public DumbPhone()
{
setTitle("Dumb Phone");
setSize(WIDTH, HEIGHT);
setDefaultCloseOperation(EXIT_ON_CLOSE);
createContents();
setVisible(true);
topLeftButton.setEnabled(false);
}
private void createContents()
{
//create JPanel, and JTextArea display
JPanel panel = new JPanel(new GridLayout(5,3));
display = new JTextArea();
display.setPreferredSize(new Dimension(280, 80));
display.setFont(new Font("Helvetica", Font.PLAIN, 32));
display.setLineWrap(true);
display.setEnabled(false);
panel.add(display);
//create JButtons
topLeftButton = new JButton(DELETE_BUTTON_TEXT);
topMiddleButton = new JButton((CALL_BUTTON_TEXT));
topRightButton = new JButton((TEXT_BUTTON_TEXT));
numberButtons = new JButton[10];
numberButtons[1] = new JButton("<html><center>1<br></center></html>");
numberButtons[2] = new JButton("<html><center>2<br>ABC</center></html>");
numberButtons[3] = new JButton("<html><right>3<br>DEF</right></html>");
numberButtons[4] = new JButton("<html><center>4<br>GHI</center></html>");
numberButtons[5] = new JButton("<html><center>5<br>JKL</center></html>");
numberButtons[6] = new JButton("<html><center>6<br>MNO</center></html>");
numberButtons[7] = new JButton("<html><center>7<br>PQRS</center></html>");
numberButtons[8] = new JButton("<html><center>8<br>TUV</center></html>");
numberButtons[9] = new JButton("<html><center>9<br>WXYZ</center></html>");
numberButtons[0] = new JButton("<html><center>0<br>space</center></html>");
poundButton = new JButton("#");
starButton = new JButton("*");
//add JButtons to buttons JPanel
panel.add(topLeftButton);
panel.add(topMiddleButton);
panel.add(topRightButton);
panel.add(numberButtons[1]);
panel.add(numberButtons[2]);
panel.add(numberButtons[3]);
panel.add(numberButtons[4]);
panel.add(numberButtons[5]);
panel.add(numberButtons[6]);
panel.add(numberButtons[7]);
panel.add(numberButtons[8]);
panel.add(numberButtons[9]);
panel.add(starButton);
panel.add(numberButtons[0]);
panel.add(poundButton);
//add Listener instance (inner class) to buttons
topLeftButton.addActionListener(new Listener());
topMiddleButton.addActionListener(new Listener());
topRightButton.addActionListener(new Listener());
//JButton[] array = new JButton[10];
for (int i = 0; i < numberButtons.length; i++)
{
numberButtons[i].addActionListener(new Listener());
numberButtons[i] = new JButton(String.valueOf(i));
}
starButton.addActionListener(new Listener());
poundButton.addActionListener(new Listener());
//add display and buttons to JFrame
setLayout(new BorderLayout());
add(display, BorderLayout.NORTH);
add(panel, BorderLayout.CENTER);
}
private class Listener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == topLeftButton)
{
if(lastPressTime == null)
{
display.setText(ENTER_NUMBER_TEXT);
}
else
{
topLeftButton.setEnabled(true);
lastCharacterIndex--;
lastPressed = lastPressTime.toString();
}
}
else if(e.getSource() == topMiddleButton)
{
if(lastPressTime == null || lastCharacterIndex == 0)
{
display.setText(ENTER_NUMBER_TEXT);
}
else
{
display.setText(CALLING_DISPLAY_TEXT);
}
}
else if(e.getSource() == topRightButton)
{
if(lastPressTime == null || lastCharacterIndex == 0)
{
display.setText(TEXT_DISPLAY_TEXT);
}
else
{
display.setText(CALLING_DISPLAY_TEXT);
}
}
else
{
topLeftButton.setEnabled(true);
if (e.getSource() instanceof JButton)
{
//String text = ((JButton) e.getSource()).getText();
display.setText(lastPressed + " f" + numberButtons[lastCharacterIndex].getText());
}
}
Date currentPress = new Date();
long currentTime = currentPress.getTime();
if(lastPressTime != null)
{
//long lastPressTime = lastPressTime.getTime();
//subtract lastPressTime from currentPress time to find amount of time elapsed since last button pressed.
}
lastPressTime = currentPress;
String buttonLetters = ""; // Parse Letter from button (e.g "abc").
//update lastCharacterIndex.
lastCharacterIndex++;
lastCharacterIndex = lastCharacterIndex % buttonLetters.length();
}
}
for example, if I push the button 2, instead of giving me "2", it will give me < html>< center>2ABC < / center >< / html >
Therefore, I need help with
Having the numberButtons, when pushed to show the numbers that were pushed.
Be able to delete those numbers.
Here is the link to the sample run: https://www.youtube.com/watch?v=evmGWlMSqqg&feature=youtu.be
Try starting the video 20 seconds in.
to delete the number, you can use the labelname.setText("")
At a basic level, you simply want to maintain the "numbers" separately from the UI. This commonly known as a "model". The model lives independently of the UI and allows the model to be represented in any number of possible ways based on the needs of the application.
In your case, you could use a linked list, array or some other simple sequential based list, but the easiest is probably to use a StringBuilder, as it provides the functionality you require (append and remove) and can make a String very simply.
So, the first thing you need to do is create an instance of model as an instance level field;
private StringBuilder numbers = new StringBuilder(10);
this will allow the buffer to be accessed any where within the instance of the class.
Then you need to update the model...
else
{
topLeftButton.setEnabled(true);
if (e.getSource() instanceof JButton)
{
String text = numberButtons[lastCharacterIndex].getText();
numbers.append(text);
}
}
To remove the last character you can simply use something like...
if (numbers.length() > 0) {
numbers.deleteCharAt(numbers.length() - 1);
}
Then, when you need to, you update the UI using something like...
display.setText(numbers.toString());
Now, this is just basic concepts, you will need to take the ideas and apply it to your code base
I have programatically created input fields on my jframe. Now I want to create a save button that will save ALL the results to a database. I am a beginner with JAVA thus not familiar. I have a entity object for the results, and a controler to save to database. This is not the problem but my problem is writing the event handler.
private void jComboBoxSurveyFocusLost(java.awt.event.FocusEvent evt) {
// TODO add your handling code here:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("PTSchemePU");
EntityManager em = emf.createEntityManager();
jPanelTests.setLayout(new GridLayout(0, 1));
Query surveyQ = em.createNamedQuery("Survey.findBySurveyDescription");
surveyQ.setParameter("surveyDescription", jComboBoxSurvey.getSelectedItem().toString());
Survey survey = (Survey) surveyQ.getSingleResult();
int testset_ID = survey.getTestset();
Query testsetQ = em.createNamedQuery("TestsetV.findByTestSet");
testsetQ.setParameter("testsetid", testset_ID);
List<TestsetV> TestSetList = (List<TestsetV>)testsetQ.getResultList();
totalTests = TestSetList.size();
JPanel[] myPanel = new JPanel[totalTests];
JLabel[] myTestID = new JLabel[totalTests];
JTextField [] mytextfield = new JTextField[totalTests];
JComboBox[] myCombo = new JComboBox[totalTests];
JCheckBox[] myNotReturn = new JCheckBox[totalTests];
JCheckBox[] myNotEval = new JCheckBox[totalTests];
JComboBox[] myReason = new JComboBox[totalTests];
JButton[] mySave = new JButton[totalTests];
jLabelTestcount.setText(Integer.toString(totalTests));
jLabelToberesulted.setText(Integer.toString(totalTests));
for (int tst=0; tst< TestSetList.size(); tst++) {
myPanel[tst] = new JPanel();
myTestID[tst] = new JLabel();
mytextfield[tst] = new JTextField();
myNotReturn[tst] = new JCheckBox("Not Returned");
myNotEval[tst] = new JCheckBox("Not Evaluated");
myReason[tst] = new JComboBox();
mySave[tst] = new JButton("Save");
Query qR = em.createNamedQuery("Lookups.findByLookupType");
qR.setParameter("lookupType","REAS");
java.util.List<Lookups> reasonList = (java.util.List<Lookups>)qR.getResultList();
for (int i = 0 ; i < reasonList.size(); i++) {
Lookups lu = reasonList.get(i);
myReason[tst].addItem(lu.getLookupDescription());
}
myPanel[tst].setLayout(new SpringLayout());
int rows =1;
int cols = 5;
myPanel[tst].setSize(10, 10);
myPanel[tst].setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
myPanel[tst].setVisible(true);
jPanelTests.add(myPanel[tst]);
mytextfield[tst].setSize(10, 10);
myNotReturn[tst].setName("No Return");
myNotEval[tst].setName("Not Evauated");
JLabel testName = new JLabel(TestSetList.get(tst).getTestDesctiption());
myPanel[tst].add(new JLabel(Integer.toString(TestSetList.get(tst).getTestsId())));
myPanel[tst].add(testName);
switch (TestSetList.get(tst).getTestSetup()){
case "TEXT" : {
myPanel[tst].add(mytextfield[tst]);
break;
}
case "COMB" : {
Query q = em.createNamedQuery("Lookups.findByLookupType");
q.setParameter("lookupType",TestSetList.get(tst).getLookup() );
java.util.List<Lookups> lookupList = (java.util.List<Lookups>)q.getResultList();
for (int i = 0 ; i < lookupList.size(); i++) {
Lookups lu = lookupList.get(i);
cb.addItem(lu.getLookupCode());
}
myPanel[tst].add(cb);
break;
}
case "SPIN" : {
myPanel[tst].add(sp);
break;
}
} // end switch
myPanel[tst].add(myNotReturn[tst]);
myPanel[tst].add(myNotEval[tst]);
myPanel[tst].add(myReason[tst]);
myPanel[tst].add(mySave[tst]);
SpringUtilities.makeCompactGrid(myPanel[tst], 1, myPanel[tst].getComponentCount(),6,6,6,6);
}
pack();
jPanelTests.setVisible(true);
}
I then created a event handeler when the panel loses focus
myPanel[tst].addFocusListener(new FocusListener() {
#Override
public void focusGained(FocusEvent e) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
#Override
public void focusLost(FocusEvent e) {
myResults[tst].setResultValue(mytextfield[tst].getText());
}
});
But now I get a error (local variables refferenced from an inner classmust be final of effectivly final) on the line myResults[tst].setResultValue(mytextfield[tst].getText());
How can I reference to the value entered in the jTextField/JComboBox/jSpinner
Thanks
Your counter variable tst is not final (meaning no final keyword is used), nor effectively final (meaning it is modified), and as such, it cannot be referensed from an inner class - in your case an instance of FocusListener.
You cannot mark tst as final, as you modify it - but you can create a new variable in the body of the loop.
Note that effecively final concept is new to Java8, in earlier versions you had to be explicit and add final keyword to all local variables accessed from inner class.
Study the example below:
public class TestFinalVariables {
public static void main(String[] args) {
String effectivelyFinal = "aaa";
for (int tst=0; tst< 10; ++tst) {
final int j = tst; //explicit final not necessary here
new Runnable() {
#Override
public void run() {
System.out.println(effectivelyFinal);
System.out.println(j);
//System.out.println(tst); Won't compile
}
}.run();
}
}
}
I'm working on a TextTwist java implementation and I'm currently working on the GUI. I was wondering if some of you Swing geniuses could help me out. I'm trying to do a GUI where whenever a button is clicked, the text of that button is written into the first empty textField below it. I'm having trouble thinking through how to do it. What I've tried so far makes the first button click fill all the TextFields.
Any help or pointers in the right direction would be great.
private void makeButtonLayout() {
this.charArray = new char[6];
ArrayList<Character> charArrayList = new ArrayList<Character>();
this.charArray = this.randomString.toCharArray();
for(char tempCharacter : this.charArray){
charArrayList.add(tempCharacter);
}
for (int i = 0; i< 6; i++){
JButton letterButton = new JButton();
Character buttonCharacter = charArrayList.get(i);
charArrayList.remove(i);
String letterString = buttonCharacter.toString();
letterButton.setText(letterString);
this.letterButtonsArray.add(letterButton);
}
for (final JButton currentButton : this.letterButtonsArray){
this.buttonPanel.add(currentButton);
currentButton.addActionListener(new ActionListener(){
#Override
public void actionPerformed(ActionEvent arg0) {
int i = 0;
currentButton.setVisible(false);
JTextField temporaryTextField = new JTextField();
String temporaryString = currentButton.getText();
temporaryTextField.setText(temporaryString);
if(textFieldArray.get(i).getText().isEmpty()){
textFieldArray.get(i).setText(temporaryString);
return;
}else{
i++;
return;
}
}
});
}
}
I think you method is really strange. You mixed initialization code and execution code. Do it like this:
for (final JButton currentButton : this.letterButtonsArray){
this.buttonPanel.add(currentButton);
currentButton.addActionListener(new ActionListener(){
#Override
public void actionPerformed(ActionEvent arg0) {
currentButton.setVisible(false);
String temporaryString = currentButton.getText();
for(int i = 0; i < textFieldArray.size(); i++)
JTextField elem = textFieldArray.get(i);
if(elem.getText().equals("")){ // or if you don't want spaces do: elem.getText().trim().equals("");
elem.setText(temporaryString);
break;
}
}
}
});
}
I am trying to create and simple program that has the user input 4 fields using the JFrame and textfields. Save those into a class. Put that class into an ArrayList (So they have the option to delete / or add more "classes" to it later). Then display all the contents of the ArrayList on one Frame.
I got the four fields to work I believe , but the part where the ArrayList contents are supposed to be displayed is not working ( I get a blank frame ).
this is my add into the arrayList ..
public void newEntryFrame()
{
JFrame entryFrame = new JFrame("Passafe");
entryFrame.setVisible(true);
entryFrame.setSize(500, 500);
entryFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
entryFrame.setLocationRelativeTo(null);
entryFrame.setLayout(new FlowLayout());
header.setFont(new Font("Serif", Font.BOLD, 16));
entryFrame.add(header);
entryFrame.add(nameLabel);
entryFrame.add(nametf);
entryFrame.add(usernameLabel);
entryFrame.add(usernametf);
entryFrame.add(passwordLabel);
entryFrame.add(passwordtf);
entryFrame.add(descriptionLabel);
entryFrame.add(descriptiontf);
entryFrame.add(enterButton);
enterButton.addActionListener(this);
}
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source == enterButton)
{
name = nametf.getText();
description = descriptiontf.getText();
username = usernametf.getText();
password = passwordtf.getText();
totalEntries++;
JOptionPane.showMessageDialog(null, "SAVED");
}
else if(source == okButton)
{
JOptionPane.showMessageDialog(null, "Ok Button Works");
}
}
this is what I have to display the arrayList.
public void viewEntryFrame()
{
JFrame viewFrame = new JFrame("Passafe");
viewFrame.setSize(500, 500);
viewFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
viewFrame.setLocationRelativeTo(null);
viewFrame.setLayout(new FlowLayout());
viewFrame.add(listHeader);
newEntry tempView = new newEntry();
for(int i = 0; i < totalEntries; ++i)
{
tempView = entries.get(i);
viewFrame.add(tempView.display);
}
viewFrame.add(okButton);
okButton.addActionListener(this);
viewFrame.setVisible(true);
}
I might be doing this completely wrong if so could you point me in the right direction.
I don't think you ever called setContentPane() A JFrame has only one component in the main part of it. You have to create a JPanel to which you can add all of the components you want, then add that to your JFrame.
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.add(/**whatever you want in your JFrame**/);
//...
panel.add(/**whatever you want in your JFrame**/);
frame.setContentPane(panel);
You never seem to be adding anything to your entries list...
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source == enterButton)
{
name = nametf.getText();
description = descriptiontf.getText();
username = usernametf.getText();
password = passwordtf.getText();
totalEntries++;
// Nope, nothing here...
JOptionPane.showMessageDialog(null, "SAVED");
}
//...
}
Also, this is very dangrouos...
newEntry tempView = new newEntry();
for(int i = 0; i < totalEntries; ++i)
{
tempView = entries.get(i);
viewFrame.add(tempView.display);
}
Rather the relying on the actual side of the ArrayList, you relying on some other variable, which may or may not equal the actual size, instead you should be using ArrayList#size, for example
for(int i = 0; i < entries.size(); ++i)
{
newEntry tempView = entries.get(i);
viewFrame.add(tempView.display);
}
Or if you're using Java 5+...
for(newEntry tempView : enties)
{
viewFrame.add(tempView.display);
}