How To Copy And Paste Code Onto Forums

Mar 9, 2014

I'm trying to copy and paste(highlight) my code into the forums thread, but am still not sure on how to do it. I've looked in this link: Announcements - What's Wrong With My Code?But still, I am still not sure on where to put the highlight info. Also, I'm using the latest version of Eclipse.

View Replies


ADVERTISEMENT

Cut / Copy / Paste / Delete And Select All Are Not Working

Mar 22, 2014

I am quite new to Java programming. I'm actually taking a class and I have an assignment due tonight. The program below compiles and functions correctly for the most part. It is supposed to be a simple GUI Text Editor with Edit and Format functions. Of the functions under the "Edit" menu, only word count actually works. Cut, copy, paste, delete, and select all are not working.

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
import java.util.regex.Pattern;

[code]....

View Replies View Related

Swing/AWT/SWT :: Copy And Paste Popup Menu

May 26, 2008

I need to make a popup menu contains copy and paste in a swing to copy or paste from jlabel or jtextbox , but i dont know how?

View Replies View Related

How To Create Folder And Copy Documents From JAR File Into Folder With Code

Sep 8, 2014

Where can I learn or how can I, being the most efficient way known to do so, create a folder outside my JAR file with the java source code, this then will copy YAML documents from my JAR file to that folder, then I need to read the YAML documents some way. I'm making an addon for a game, I am using an API that allows you to make a config.yml easily, and add and read entries from it, but I've read that I need to make my own methods to be able to create additional YAML documents.

I don't exactly know what to type in google to perhaps find such a page, but I did try to find a tutorial page about this or something and couldn't.

I've partially figured out how to create a folder, but I have a problem, how can I RETURN one directory to make the folder, I don't want to make the folder in the JAR file I want to make it just outside the Jar file in the same folder that the Jar file is at.

View Replies View Related

Sort Excel And Paste It On Webpage

Jan 13, 2015

import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

[Code]...

This is the excel sheet which is to be sorted and here I am stuck because I need to search "Type" if the country column from excel is uk or us.I am new to java and apache poi . I am stuck here . I have written the above code and everytime it gives me "single" as output and keep on searching that in google.

View Replies View Related

How To Copy Elements Of One Array Into Another

Mar 29, 2015

I have two arrays

private ReservedBook[] reservedBooks;
private LibrarySystem[] libraryBooks;

The library array has two books and I want to copy one of them to the reserved books when you type in the ISBN

public void borrowBook(String ISBN)
{
int i = 0;
if(numberOfBooks < MAX_BOOKS-1)
{
if(libraryBooks[i].getBookISBN().equals(ISBN))
{
for(i=0;i<MAX_BOOKS-1;i++)
reservedBooks[i] = libraryBooks[i];
}
else System.out.println("There is no such book");
}
else System.out.println("You have reached the maximum number of allowed books");
}

It shows me error: incompatible types - LibrarySystem cannot be converted into ReservedBook. How can I fix it?

View Replies View Related

Error In Array Value Copy

Aug 6, 2014

I am trying to copy all odd value of an array in one array and all even value in another array

this what i have try to so far

private static void arrayOperation(int[] a) {
// TODO Auto-generated method stub
int n=a.length;
int odd_value[] = {};

[Code].....

But i am getting error

View Replies View Related

Copy A Exe File From One Location To Another?

Aug 1, 2014

I'm trying to copy a exe file from one location to another. It seems simple, but I have failed to find anything about it besides coping the contents in txt files, but that does nothing for executable.

View Replies View Related

Copy File With Name And Timestamp?

Jun 8, 2014

I read and then copy files into a subfolder, and I need to rename the file names by adding the timestamp to the file name, for example like: "filename1_25.06.14_15:00:00.txt". How can I do that? Here is what I have:

public class Table_data {
static String files = null;
static List<O> l= new ArrayList<O>();

[Code]....

is it right what i tryed, because i get nothing with timestamp in file after running this.

View Replies View Related

Complicated Data Copy

Jun 14, 2014

Disaster has struck some of ACME's redundant data centers. The administrators have managed to restore backups, but some data sets are still missing from some data centers. Fortunately, every data set can be found at least once in one or more of the data centers. However, before ACME can resume normal operations, it needs to ensure that each data center has a copy of every data set.Your goal is to ACME resume normal operations by writing a program to synchronize data sets between data centers using as few copies as possible.

The first line of input will contain an integer between 0 and 999999 inclusive, representing the number of data centers.Following that will be one line of input for each data center. Each line will contain an integer from 0 to 299 representing the number of data sets at that data center, followed by a space and space-separated list of data set ids currently present at that data center. Data set ids are each an integer between 1 and 999999, inclusive. Each line will be at most 999 characters long.Data set ids are not necessarily consecutive. The list of data sets will not be in any particular order.

Output:The program must output an optimal data set copy strategy to ensure that every data center has a copy of every data set. Output one line for every copy instruction.A copy instruction is of the form <data-set-id> <from> <to>, where <data-set-id> is the data set id, <from> is the index of the data center the data set will be copied from (1 = the first data center), and <to> is the index of the data center to copy the data set to.When there are no more copy instructions, the program must output the word "done" on a line by itself. There is often more than one correct output with minimal number of operations for a given input, and any output that satisfies the requirements is valid.

Example 1:
----------
Input:
4
3 1 3 4
3 1 2 3
2 1 3
3 1 4 2
One Possible Correct Output:
2 2 1
4 1 2
2 2 3
4 4 3
3 1 4
done

Example 2:
----------
Input:
2
2 1 2
2 2 1
Output:
done

View Replies View Related

How To Do A Deep Copy Of Objects That Contain References

Mar 21, 2014

how to do a deep copy of objects that contain references. I am specifically wanting to make a deep copy of a tree. Logically, each tree node contain references to its children nodes. Here is the basics of my node class

public class BSTNode implements Comparable, Serializable {
 
private String token;
private int count;
private BSTNode leftChild;
private BSTNode rightChild;

I know I must only be making a shallow copy because when I make a copy of tree1, called tree2, and edit tree1 the edits also appear on tree2. Here is my copy method within my BSTNode class

public BSTNode copy()
{
BSTNode obj = null;
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
out.writeObject(this);
out.flush();
out.close();

[code]....

When I wish to copy the entire tree, I call that above copy method from my BSTree class using the methods below. (I have 2 methods because this is a homework assignment that requires a copy method that calls a preorder traversal method)

public BSTNode copy()
{
BSTNode copiedTreeRoot = new BSTNode();
return copyTree(copiedTreeRoot,root);
 
[code]....

And further along when I make changes to tree1, tree 2 also changes. I have no clue what I'm doing wrong. I believe it must be somewhere in how I return the new tree or something.I tried this edit to my copy method, but it made no difference.

public BSTNode copy() {
BSTNode obj = null;
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
out.writeObject(this);

[code].....

View Replies View Related

Copy Selected Value From JComboBox To JTextField

Apr 16, 2014

If I have a ComboBox and I want to copy the selected value to textfield. How can I do it?

View Replies View Related

Copy Specific Array Data?

Dec 4, 2014

if there was a way to copy specific array info into a temp array with more concise code?

This is the code I have for instance:

tempList[0] = myCube.orange[2];
tempList[1] = myCube.orange[5];
tempList[2] = myCube.orange[8];
tempList[3] = myCube.blue[6];
tempList[4] = myCube.blue[7];
tempList[5] = myCube.blue[8];

But isn't there any way I could just condense it to be like:

tempList[0,1,2] = myCube.orange[2,5,8];

It would save me from 72 lines of code down to 24 if I could rock it all on one line.

View Replies View Related

Swing/AWT/SWT :: Copy A Graphics On Jframe?

Apr 28, 2015

I want to know know to copy a rectangle on my jframe and paste it in another location on the same jframe.

View Replies View Related

Copy ArrayList Object Into Array

May 29, 2014

package com.practice;
public class Car {
private String name; //name of the car
private String modelName; //Name of the model
private int year; //The year car was made in
private int speed=0;

[Code] ...

It wont let me copy it into a array is there any solution to this.

View Replies View Related

Copy Target Of Link In Windows

Dec 8, 2014

How to copy the target of a link? I am using Apache's FileUtils class. I have tried the following and it only copies the link, not the target:

import org.apache.commons.io.FileUtils;
import java.io.File;
public class Copier {
public static void main(String[] args) {
File sourceFile = new File("C:/Demo/sourceDir/a_link.lnk");
File destinationDirectory = new File("C:/Demo/destinationDirectory");
FileUtils.copyFileToDirectory(sourceFile, destinationDirectory);
}
}

View Replies View Related

Copy Array Content To Arraylist

Apr 27, 2015

I have a text file which contains to integer values I need to retrieve for each item (total of 56 items in the file). One is an item number, the other the weight ("Item: " + number + "Weight: " + weight). I am trying to build an array list that will add each set of data to it. I know that when I add the item array to the arraylist it is storing the array variable and not its contents, so is there a way to easily copy that data array to the array list?

ArrayList newInventory = new ArrayList();
int[] item = new int[2];
while(sc.hasNext()) {
String itemVal = br.readLine();
if(sc.hasNextInt()) {
item.add(sc.nextInt());
}
}

View Replies View Related

I/O / Streams :: How To Copy A Flash Drive

Jul 12, 2014

I want to know which Java class and method that can be called in order to copy the content of a flash drive(usb) without opening the flash drive. If possible also to know the prodecure on how to do it. I've tried some overloaded methods of copy() from the java.nio package.

View Replies View Related

Copy Matching Numbers From Two Arrays Onto New One

Jun 4, 2014

I want my function to return an array, with the array holding just the values of data that appear in good.

This is what should be returned:

{3, 5, 3, 2, 3, 3}

What is currently being returned:

{0, 3, 5, 3}

I didn't want to miss any numbers, so I decided to iterate through j for the "good" array, and then just i for the one that I was looking for matching numbers. Perhaps part of the problem is that if the condition is met, it goes to the next iteration of the loop. I'm not sure.

public class Arrays2 {
public static void main(String args[]){
int [] data = {8, 3, 5, 3, 7, 2, 8, 3, 3 };
int [] good = {5, 2, 3, 2};
int [] result = f2(data, good);
for (int i = 0; i < result.length; i++){

[Code] ....

View Replies View Related

How To Just Copy A Link To Results Page

Dec 17, 2014

I'm working on a simple site for my friend, and he asked me to link to his other site. I need to have the link to a specific search. For example, if I search for "Heathrow," I need to be able to link a button on the other site so that it can be clicked and directed to the search results on this page. Problem is that this is apparently all Java (which I know nothing of) and how to just copy a link to the results page.

View Replies View Related

Arrays Classes With Copy Constructor

Sep 29, 2014

Here is the exact instruction for the assignment...

Make 2 classes WrapperShallow and WrapperDeep.
Each class is simply a wrapper class to hold a private array variable. int [] a;
The default constructor for each class should initialize “a”.
Each class should have a toString() and equals().
Each class should have a setArray method that allows you to set the “a” variable.
WrapperShallow should have an invalid copy constructor.

[Code] ,....

Think about why shallow is wrong and deep is correct! What happens to the old “a” in the WrapperDeep copy
constructor? (think garbage collection)

Example Output:

--------------------Configuration: <Default>--------------------
**** TESTING SHALLOW OBJECTS ****
inital shallow object contains
7 17 77
copy shallow object contains
7 17 77
inital shallow object changed to
13 14 15
copy shallow object not changed contains
13 14 15

[Code] .....

So far I've only finished part of the WrapperDeep class. I can't get my equals method to work properly, I keep getting the error:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - missing return statement
at WrapperDeep.equals(WrapperDeep.java:27)
at WrapperTest.main(WrapperTest.java:18)
Java Result: 1

My class looks like this:

public class WrapperDeep {
private int a[] = new int[3];
public WrapperDeep(int x, int y, int z){ //constructor initializes 3 integers in array
a[0] = x;
a[1] = y;
a[2] = z;

[Code] ....

View Replies View Related

Copy File From C To Another Drive And Avoid Duplication?

Jan 12, 2014

Write a program to copy file from c: drive to another drive and avoid duplication??????????

View Replies View Related

Printing Database Report In Hard Copy

Jun 18, 2014

How to print database report in hard copy. I have try to do this with the code below but it only print empty plain paper. Find the code below:

printbtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Vector columnNames = new Vector();
Vector data = new Vector();
String host = "jdbc:odbc:staffsalary";

[Code] .....

The code is part of a program that do other task.

View Replies View Related

How To Copy 5x5 Array Into 6x6 And Store New Value To Take Up Sixth Position

May 5, 2015

I want to take my 5x5 array that reads data from a file, add the rows and columns, then print out a new 6x6 array with those values. Here is my code that shows I understand everything except this.

import java.io.*;
import java.util.*;
public class prog470cAddingRandC
{
public static void main (String [] args)
{
//read the file
Scanner inFile=null;
 
[Code] ....

I was told in a previous question to make the starting array 6x6 but that is not working. How do I take sum1 and sum2 and store that along with the values of the old array and print it?

View Replies View Related

Run Application From Removable Flash Drive That Has Copy Of JRE

Feb 9, 2014

Is it possible to run an application from a removable flash drive that has a copy of the jre.  I am running an application on computers that have had the install run from flash disks but can not run on machines where the installation hasn't been done.

View Replies View Related

Program Should Copy Person With Highest Percent From File

Mar 23, 2014

The program should copy person with the highest percent from the file 'plik1', and then put it to the file 'plik2'.The problem occurs while compiling.

Java Code: string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type mh_sh_highlight_all('java'); Code:

[code]....

View Replies View Related







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