I am trying to create a JTable and I want to implement an undo option in it. Is it possible that I store the table model at some part of the operation and later when i press an undo button or something, I can set the saved table model so that it will perform like an undo.
I need to design 'notepad' application as my assignment.
Requirement: Only text is allowed, all the characters are having same size and font. It should have feature like new, open, save , save as , exit , UNDO , find , replace and font.
For this i use JTextArea and menu bar .
I am able to develop features like new, open, save , save as , exit. Need to implement now UNDO , find , replace and font but struck at 'UNDO'.
UNDO feature should be enable only when user writing in the writing area but not when it opens any file. What i thought is to have a flag on whenever user save whatever he wrote and if he use select UNDO then it check for the flag. If flag is ON then it will not do UNDO and if flag is not set then it cleared everything from the Text Area.
So I have a program where you can log in and add/remove friends to and from the friends arraylist. Also I can like a certain thing and that thing will be stored into the likes arraylist. I'm asked to make undo and redo options for whichever action I do.I want to add apple as a friend. After that when I select the undo option, I can undo that action so apple wouldn't be my friend. How I can approach this with a Command Pattern when the input is whatever name or word I inputted to store into the friends arraylist?
I did some research and found that using a command pattern could be my best bet since this has to be done under the Facebook Class I already have. I decided to add parts of what I have ...
In the driver program
Facebook facebook1 = new Facebook();
if (userInput == 6) { System.out.println("Login"); String operand1 = getOperand("What is the Username? "); String operand2 = getOperand("What is the Password? "); System.out.println("Enter a friend to be added. "); String operand3 = getOperand("What is the Username? "); facebook1.friend(operand3);
I'm trying to hide a JComboBox option depending if the a user has picked a certain option from a previous JComboBox.
.setVisible(false). doesn't work
String[] Dest = new String[] {"Select Destination","Crete", "Paris", "Croatia"}; String[] Accomodation = new String[] {"Select your Accomodation","Hotel", "Villa", "Bed & Breakfast","Youth Hostel"}; String[] Night = new String[] {" Select number of Nights", "7","10","14"}; final JComboBox<String> comboDest1 = new JComboBox<String>(Dest);
[Code] ....
I know setVisible isn't the way it's done but i don't know how to do it
I'm trying to write a program where the user has the option to enter either an int or double but whatever input I enter just gets cast to a double. Do I even have the right Idea by using if else statements?
import java.util.*; public class VS { public static void main(String[] args) { Scanner Input = new Scanner(System.in); System.out.println("Please enter a number"); if (Input.hasNextDouble()) {
The output of value="${user.id}" is retrieved from a DB, it looks like this:
Id Nombre usuario Email Fecha de registro Acción 1 isaac2 @2 1986-01-01 *Delete(input) *Here there is check box 2 isaac3 @3 1988-01-01 *Delete(input) *Here there is check box
Then depending of which check box I selected then the row by the side should be selected by id and deleted.But what happens is that doesnt matter which check box I select, always the first row is deleted. I understand that at the first iteration of the loop it just take the first id, it doest attach the id I have choosen to the row it belongs to
I have a jsp form that has a drop down option for a user to select. I would like to know how to have a pre-selected option that has been retrieved from my database or provide a default option if none has been selected by the user. My form allows a user to update a record in my database and what I need to achieve is when a user is updating an existing record they do not have to touch the drop down box if the do not need to change that option.
I have to create 3 JLabel for Option, Square and Direction. Well, I did but its not in the right place. It should be in the right Panel but i did change the code so its in panelRight1 but its still not changing? Its somehow not working and no matter how i try to change the position of it, it doesnt change at all.
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CBallMaze extends JFrame implements ActionListener { /** * */ private JMenu[] menu = {
I understand the stack part of it, just not the loop, specifically how you give the user more than one option to input.
Implement a printer driver that handles incoming print jobs. The driver will behave in the following manner:
- Loop giving the user the following options: ADD print job, DELETE latest print job, and QUIT - Recording the following information from each job: computer name, document name, and number of pages - When the user chooses to ADD, add a new print job to the top of the stack - When the user chooses to DELETE, pop off the latest print job and output to the screen which job has just been deleted - When the user chooses to QUIT, output the print jobs still in the stack (in order from top to bottom) - Output must include all relevant information for each job.
There is my code so far, on the line JOptionPane.showInputDialog(null, "Give us a word starting with "+text[i]+":", "tut", 2, image, ?, null);, eclipse gave me 2 extra arguments following the icon and I'm not sure what exactly goes into the 2nd to last, the "selectionValues" argument.
After checking the Java docs, it was apparent that the option buttons goes into the selectionValues argument, but is there a way to work past that if I would only like the default (OK, Cancel) buttons on my window? The school haven't taught us the method to create custom buttons and I doubt I would've been set something that was not taught.
SceneBuilder 2.0 on my computer shows no onAction for ChangeBox. How to get around this? Several of the Java coding options listed online do not work with JavaFx 2 and SceneBuilder.
When I run my program and choose option 2 to get contact details I am expecting it to display as follows (First Name, Last Name): Contacts how have been entered:
0) John Doe 1) George Smith 2) Nancy Davis
Please enter the number corresponding to the contact you would like to view:
Instead for a personal contact it is displaying as follows:Contacts who have been entered:
0) Doe 1 F St. (last name, address)
Please enter the number corresponding to the contact you would like to view:
Instead for a business contact it is displaying as follows:Contacts who have been entered:
0) 1 F St. jd@gmail.com (address, email)
Please enter the number corresponding to the contact you would like to view:
Then when I enter the number to display the contact for personal it is returning me only first name and business is only returning me first and last name. It should be returning the full contact info that was put in during the add contact step. I thought I programmed everything properly but it isn't displaying what I want to seeMy code is listed below.
ContactList
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package contactlist; import java.util.ArrayList; import java.util.Scanner;
I want to implement a 'Keep me signed in' option in the login page of an application. I have noticed this option is present in the form of a checkbox on the login page of many websites but i don't know how it can be coded . When selected, a user is no longer asked for his username and password on subsequent sessions but he is automatically given access.
public class App { public static void main(String[] args) throws IOException { Scanner keyboard = new Scanner(System.in); System.out.println("Please Select an option > ");
My requirement is - I need to browse the folder and select multiples and upload all the selected files at once. note that here i need to use single browse button ONLY.
I need to compare two jtable and set the value from one jtabel to the other jtable.
jtable one consist of:
Unit ID Unit Name Access
ABC, Inc ABC Incorporate (checkbox) value = uncheck
CDE, Inc CDE Incorporate (Checkbox) value = uncheck
jtable two consist of:
Unit ID Access
ABC, Inc ABC Incorporate (checkbox) value = checked CDE, Inc CDE Incorporate (Checkbox) value = checked
if comparing jtable one an jtable two has the same Unit ID then colum Access from jtable two value is set to jtable one become check based on jtable two.I did the code but did not work:
for (i = 0, jTable1.getrowcount(), i++) { for (j = 0, jTable1.getrowcount(), j++) { if (jTable1.getvalueAt(i,0) == jTable2.getvalueat(j,0)) { jTable1.setvalueat(true,i,2) } } }
How to get value from jTable? I use mouse click event for my jtable and then, i want to set value to datechooser. Usually my behaviour for get value from jTable to Textfield, i'm using this method.
I have created a JTable which does not display. When I run the program I can see that a line appears around the edge of the panel indicating the JScrollPane is added to MyJPanel, however, the table is missing. This is the table
public class MyJTable extends JTable { private Object[][] data; private Object[] columns; private MyTableModel model = new MyTableModel(data, columns); public MyJTable(Object[] columns, ArrayList<Data> data) { this.columns = columns; for(Data d:data){