Stretch JFrame (with Item Inside It) To Fullscreen
Mar 17, 2015
Have this game which is 1280 by 720 and i want it to be fullscreen.....but i dont just want the size of the frame to change i also want everything inside it to "stretch"..... So for example if i had a 100 by 100 frame with a 10 by 10 image in it, and i tried to stretch the frame to the users screen which is 200 by 200, the image inside the frame would also stretch to 20 by 20... How do i do that?.........
I am developing a java based software connected with a mysql database. I have an Item table in my database. I created a bean class which can keep all item data with it and. Then I loaded each Item data in to its object and fill a Jcombobox. Now I want to search with Item name and get all Item data when selecting that item. I have overidden the toString method to Item name in that class. Is there any way to search my Item objects inside a jcombobox?
I have a Jframe and i want to add inside 4 different jpanel.This is easy.
what is difficult is how can i change them dynamically with 4 other new jpanels and 4 other new jpanels?
I have try with BorderLayout but not working.
It's a wizard like but not the same.
I have a jpanel with jbuttons jpanel with a jtable jpanel with textarea and jpanel with jlabels. All this have to change with other 4 jpanels, where to look?
I have been stuck on this now for almost a week, the problem is that the textfield keeps flickering. I have read that swing does not work well with fullscreen exclusive mode, but I'm not sure what else to do other than create my own class similar to a textfield and detect every single key press which doesn't seem the right thing to do.
- If this line is uncommented "TextFieldTest.this.tfChatField.paint(g);" then it will display the textfield at the top of the screen, and a flickering textfield at the bottom(which is where it's meant to be)
I don't really get the concept of how I "insert" an item into an array. I get a cannot find symbol error when I try to. I think its because I'm losing focus. What sort of code would "insert" an item into an array? I just want a goal of conceptually how I would do it.
Anyways, here are the instructions for the exercise:
Write a new class method, insert, for the Item class that takes three arguments - an Item[] array, an Item newItem, and an int k - and inserts newItem into array at index k, discarding the last item of the array (that is, the item originally at index array.length - 1).
Here is the uneditable code:
public class Item { private int myN; public Item( int n ) { myN = n; } public String toString()
[Code] ....
I get a cannot find symbol error, but I thought I was doing as I was supposed to. I thought you had to have an ArrayList to be able to insert or delete an item from an array. How can you take a primitive object, like an array, and insert something into it. My idea of it was a[i] would be replaced with a[i + 1]. I know I'm getting this concept wrong because that's what I tried to do.
I need to choose the value of a list item in jsp. There are many employees in various departments and i need to choose that employees in department wise.
Example. I have two list items in jsp
1. Select dept_no,dept_name from departments 2. SElect emp_name from employees, departments where emp_dept_no=curr_dept_no and curr_dept_no = dept_no
These two are the list items. When i choose the department from the first list item i need to display the employees in that particular department in the second list.
I'm trying to make a calendar that, when you click on the date, the result are stored in a map and visualized in a table that refers to a container.
I successfully created the map mechanism, but I have a problem on the list....
I add the rows in this way:
Object newItemId = container.addItem(); Item riga = container.getItem(newItemId); riga.getItemProperty("Timestamp").setValue(fara); riga.getItemProperty("Date").setValue(asa); . How can I delete a row in the list, when all I have in input is the "Timestamp" information, in a Long value?
Can a JCalendar be used as an item. I cannot find and appropriate combodatepicker or at least one that looks like a standard combobox. I cannot get an answer from google search all i can get is how to add normal items.
So I drew a menu in DrawingPanel extends JPanel, that gets user input of number of players...etc. I also have a boolean, when true, the board is drawn, but apparently, right when I run, the boolean is checked, returns false and so board isn't drawn at all. When the user finishes input, the boolean becomes true, but the board doesn't get drawn. So my question is, how do I draw something not immediately when the program is ran?
I was wanting to select an item in a comboBox and display it in a text field but all it's doing at the minute is retrieving the first item in the comboBox and placing that in the txt field
String value = (String) comboBoxEnv.getSelectedItem().toString(); if(comboBoxEnv.getSelectedItem()!= null){ txtTo.setText(value);
I have an array list in my GUI class of an aplication , the app reads in 3 fields from the user and saves these to an array list allowing the user to enter more fields to be added to the arraylist, when displaying back out to the user the same entry displays multiple times, for example if i entered , a,b,1 then c,d,2 and then e,f,3 into the app when i press my display button it would just throw back e,f,3 three times rater than the three different entries...
Constructor and instance variables
private String name; private String number; private int year; private int count; private ArrayList<StudentData> myList; private StudentData myData;
So I got an interesting challenge today. I think logically I know what I have to do but I'm at a complete loss as for the actual coding implementation. So I have to develop this method called moveToBack(T entry). What this is meant to do is as implies, move entry to the back of my queue. As simple as it sounds, I know that I cant just move its position that simple. I know that I'll have to essentially remove whatever the desired value is, and then re-add it to the back of the queue. The interesting problem with this, however; is that I know that the FIFO property exists for queue's.
So if the desired entry to be moved is at the 3rd position of 4, I'd have to remove positions 1 and 2 to finally get to 3. But I want it to keep those values still. So I assume what I'll have to do is remove each element of the queue (it'll only be 5 entries max for the purpose of the project) and save it somewhere, then empty the queue and finally add the elements back in while waiting and putting the desired element to the last position.
If that's the case, I'm really curious on how I would do this. I have 4 files, 2 interfaces, the main class that contains the methods and what not for the queue, and a 4th class that'll be used for running test data and testing the methods of the program. Now, I wont add the interfaces code below because those are fine and all methods that need to be added are. I just gotta improve my moveToBack method so that it does what its supposed to. (I know I should have exceptions instead of my very poor else statements, but for this project it's not necessary.)
public abstract class NoDuplicatesQueueWilson<T> implements NoDuplicatesQueueInterfaceWilson<T> { private int MAX_QUEUE = 5; // Default array size, small for testing purposes private T[] items; // The array of the queue. private int front; // The first entered item of a queue. private int back; // The last entered item of a queue. private int count; // A counter.
Working on my final which is due today, its' and Inventory Program which I have been working on for the last 5 weeks. My Buttons on my GUI Add/Delete doesn't add items to my inventory. I'm not sure exactly what wrong with my code, I'm not getting any error and the Program compiles just fine, I just can get the Items to add of delete.
my Delete button starts on line 281 my Add Button begins on line 319
// /** Purpose:the purpose of this software is to display inputs as wells as the stocks and price of inputs, *as well as display a 5 % restocking fee per dvd and for the entire Invenotry of each object. *adding a GUI to the code. Adding a Previous button to the existing code allowing the user to cycle through *the Inventory list freely. Also adding a graphics logo to page. adding more buttons and allowing program to *save new items added to the inventory. **/
When I try popping everything off my stack, it leaves the last item alone. The size comes out correct when I print it out, so that cant be the issue, I think. Also, it doesnt even print it out if I do
for(int i = 0; i <= s1.Size() + 1; i++)
it still leaves one value left. What am I doing wrong?
public class Test { public static void main(String[] args) { Stack<String> s1 = new Stack<String>();
s1.Push("first"); s1.Push("2nd"); s1.Push("3rd"); s1.Push("4th"); System.out.println(s1); try { System.out.println("The top item is: " + s1.Peek());
I need instantiating 3 instances of the RetailItem
//Instantiate 3 RetailItems RetailItem jacket = new RetailItem(); ITS TELLING ME: constructor RetailItem in class RetailItem cannot be applied to given types jacket= jacket.setDescription("Jacket"); <------- ITS TEllING ME: cannot find symbol jacket = jacket.setUnitsOnHand(12); jacket = jacket.setPrice(59.95);
I have a selection listener attached to a TreeView as shown below
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<Pair<VideoSourceType, String>>>() { @Override public void changed(ObservableValue<? extends TreeItem<Pair<VideoSourceType, String>>> observable, final TreeItem<Pair<VideoSourceType, String>> oldValue, final TreeItem<Pair<VideoSourceType, String>> newValue) { // do something treeView.getSelectionModel().clearSelection(); } };
What I want to do is to "do something" and then clear the selection so that it can be selected again. However, I cannot re-select the same item from the TreeView until I first select a different item.
I created a website using jsp and servlet. I made a shopping cart and got the items to display. But how can i remove the items from the cart? Next to each item is a remove button. When that is pressed the item selected needs to be removed and cart needs to refresh.
is there a good way to change the color of a JList item that isn't selected? I'm throwing my hand at building a client/server chat app and on the client side, I need to highlight the name of the person (which is in a JList) who has sent a message to the client GUI.
How can I insert a new item at the middle of a BookList . I have also got a Book class represting Book objects and a inner class BookNode referencing them.
public void add(Book newBook) { BookNode newNode = new BookNode(newBook); if (firstNode == null){ // no nodes in the list so add newNode at start firstNode = newNode; tempNode = newNode ; }