Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
4
Posts with Upvotes
4
Upvoting Members
4
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
Ranked #2K
~41.3K People Reached
About Me

math and computer science teacher.

Interests
METAL MUSIC , travels , gymnastic , reading books , newspapers .
PC Specs
Intel Core i7 3770K , 1T sata2 disk , 4GB Ram
Favorite Forums
Favorite Tags

27 Posted Topics

Member Avatar for nikolaos

I am trying to understand the structure of .class file in Java. Wrote a very simple program : package javautilities; public class Class_File_Structure { public static void main(String[] args) { int a = 10; int b = 20; int c = a + b; } } used the command javap …

Member Avatar for nikolaos
0
383
Member Avatar for nikolaos

/* PointOne type objects has three members. Two of type Integer and one of type ThreeD a custom class. PointOneClone method takes an argument of PointOne type and copy every value from his members to arguments members. So the result is a PointOne instance with the exact same values but …

Member Avatar for JamesCherrill
0
209
Member Avatar for nikolaos

Testing the following code from a book public class RunTime { public static void main(String[] args) { Runtime r = Runtime.getRuntime(); //MEMORY MANAGEMENT long mem1, mem2; Integer intmatrix[] = new Integer[1000]; System.out.println("Total memory is :" + r.totalMemory()); mem1 = r.freeMemory(); System.out.println("Initial free memory is :" + mem1); r.gc(); mem1 = …

Member Avatar for mKorbel
0
776
Member Avatar for nikolaos

ProducerConsumer_Using_ExecutorService class in a for loop initiate producer consumer threads using worker threads from ExecutorServiceThreadPool class. consumer thread takes an element from queue adding it to ArrayList consumerdata. Seems that consumerdata has no elements. why is that; Both producer - consumer threads seem to work. import java.util.ArrayList; import java.util.Iterator; public …

Member Avatar for nikolaos
0
5K
Member Avatar for nikolaos

In the following example two threads share int counter. The increment_thread thread increases counter by one . The decrement_thread thread decreases counter by one . I use semaphore to control access to counter instead of making the two methods synchronized. Is this the proper way of using semaphore? When should …

Member Avatar for nikolaos
0
389
Member Avatar for somjit{}

This is something similar i had wrote. I hope it will help you. public class Change{ private boolean flag = false; public static int commonresource=1; public synchronized void increment(int inc) { while (flag){ try{ wait(); } catch (InterruptedException e) {} } flag = true; { System.out.println("before increment :"+commonresource); commonresource += …

Member Avatar for ~s.o.s~
0
210
Member Avatar for nikolaos

One thread increases an integer named "counter" , and another decreases the same integer. Using synchronized statement on LockObject to control access to counter. If i understand correctly i have to use an Object reference. Can i use synchronized statement on counter somehow? public class Synchronized_Block_Demo { public static int …

Member Avatar for nikolaos
0
343
Member Avatar for mikewyatt
Member Avatar for reincom

Why do you ask since you have already used createMenuBar()? read this. http://docs.oracle.com/javase/tutorial/uiswing/components/toolbar.html Why do you want to make your gui using functions that return components. Can't think of any reason.

Member Avatar for JamesCherrill
0
198
Member Avatar for wallet123

You are refering to methods and not classes. Pass it as a parameter in the method you want to use .

Member Avatar for nikolaos
0
166
Member Avatar for sasikrishnasamy

Perhaps you should use BufferedReader. try (BufferedReader reader = Files.newBufferedReader(sourceFile, charset)) { String line = null; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException x) { System.err.format("IOException: %s%n", x); }

Member Avatar for sasikrishnasamy
0
260
Member Avatar for nikolaos

Using NetBeans 7.3.1 i have created a JFrame. A JLabel fills the bottom of the JFrame . The JLabel displays an ImageIcon. I want the ImageIcon automatically resize itself when JLabel resizes. Generated Code from IDE : jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Number_theory/resources/primes_ulam_spiral.gif"))); // NOI18N jLabel1.setDoubleBuffered(true); jLabel1.setOpaque(true); jLabel1.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent …

Member Avatar for JamesCherrill
0
690
Member Avatar for MichaelCJ10

I tried to maintain your structure. This works. You have to make it continue if a game is over. package GridBagLayout; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.util.Random; import javax.swing.JOptionPane; public class DisplayButtonMessage { //display action command of jbutton int matches=0; …

Member Avatar for nikolaos
0
254
Member Avatar for nikolaos

I am making a project in Number Theory and i want to display some formatting text in a textArea in my Gui. I have a method named padding which takes an integer as an argument and return a String consisitng of a number of spaces. This number is 12 - …

Member Avatar for nikolaos
0
935
Member Avatar for nikolaos

I want to list all files and directories from a start point using recursion. Here is my code. import java.io.File; import java.io.IOException; public class RecursiveWalk { void recursive (File[] allfiles) throws IOException{ for (File file : allfiles) { if (file.isDirectory()) { System.out.print("directory:"); System.out.println(file.getCanonicalPath()); recursive (file.listFiles()); } else { System.out.print(" file:"); …

Member Avatar for JamesCherrill
0
3K
Member Avatar for nikolaos

In a previous thread i had described a problem i had to transfer a frame or panel and all it's components as an image into a buffered image. I thought i had found the solution but it seems i am doing something wrong. In line 162 i call the method …

Member Avatar for NormR1
0
485
Member Avatar for nikolaos

I want to write a version of the SAND GAME. I want to examine the color of every pixel in a Jframe window. I use something like this. Toolkit toolkit = Toolkit.getDefaultToolkit (); Dimension dim = toolkit.getScreenSize(); int height = dim.height; int width = dim.width; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice …

Member Avatar for nikolaos
0
245
Member Avatar for karthikprs

package mypackage; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class datedifference { public static void main(String[] args) throws ParseException { Date userdate = new SimpleDateFormat("dd/MM/yyyy").parse("21/06/2011"); Date today = new SimpleDateFormat("dd/MM/yyyy").parse("21/06/2012"); Calendar gc1 = new GregorianCalendar(); gc1.setTime(today); Calendar gc2 = new GregorianCalendar(); gc2.setTime(userdate); long daysdiff = (gc1.getTimeInMillis() …

Member Avatar for karthikprs
0
2K
Member Avatar for london-G

Here is some code i wrote many years ago. Retrieving data from an access database and display them using a JTable (my suggestion) Maybe you will find something useful. package askhsh3; /** * * @author nikos */ import javax.swing.table.*; import java.awt.Component; import java.awt.Color; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.JTable; import javax.swing.JFrame; import …

Member Avatar for nikolaos
0
1K
Member Avatar for nikolaos

How can i add some space between these four components and the JFrame window? ![jframe_view](/attachments/large/0/jframe_view.jpg "jframe_view")

Member Avatar for nikolaos
1
18K
Member Avatar for nikolaos

After login (if succeed) a user will see the result of statement "select test_column from table_test " execution. table_test is the only table of database 'test' which i have created in NetBeans 7.0.1. test_column is the only column. class '[B]MySQLTest[/B]' creates the gui for login , connects with the database …

Member Avatar for nikolaos
0
2K
Member Avatar for nikolaos

FROM Cisco Systems, Inc. Catalyst 2950 Desktop Switch Software Configuration Guide, 12.1(9)EA1 [URL="http://www.cisco.com/en/US/docs/switches/lan/catalyst2950/software/release/12.1_9_ea1/configuration/guide/swmstp.html#wp1031378"]http://www.cisco.com/en/US/docs/switches/lan/catalyst2950/software/release/12.1_9_ea1/configuration/guide/swmstp.html#wp1031378[/URL] [B]Synchronization of Port Roles[/B] When the switch receives a proposal message on one of its ports and that port is selected as the new root port, the RSTP forces all other ports to synchronize with the new …

0
75
Member Avatar for nikolaos

I have a public class change which holds the private static int [B]commonresource[/B] and the methods : public synchronized void [B]increment[/B](int inc) public synchronized void [B]decrement[/B](int inc) to handle the variable commonresource I have a main class which starts 2 new threads "nikos" , "fosses" with a constructor that takes …

Member Avatar for JamesCherrill
0
113
Member Avatar for scream2ice

If you remove everything that is not between < > then you will be left with something like this. <html><head><title></title></head><body><p></P> </body></html>. this is a string. suppose s is a string. s = <html> hold its position (1)and length(6) if you find another tag eg <head> then s = <head> and …

Member Avatar for verruckt24
0
882
Member Avatar for nikolaos

This is a poor implementation of quicksort in pascal. I will use it in the classroom for a demonstration in sorting algorithms (divide and conquer). I would appreciate if someone could help me a little with some improvements. [code=pascal] program quicksort; uses wincrt; const max = 10; type table = …

Member Avatar for LizR
0
266
Member Avatar for nikolaos

i am trying to make an autorun cd with a digital book in java. 1) How can i find out the cd or dvd drive letter in which has entered my cd? in the code section below i use this very ugly way to achieve this. 2)which is the best …

Member Avatar for Ezzaral
0
136
Member Avatar for nikolaos

i have the following struct [code] typedef char * typos_stoixeiou; typedef int metritis; typedef struct korifi *kdiktis ; struct korifi { typos_stoixeiou dedomena; metritis counter; int kleidi; int arithmospaidiwn ; korifi *a[100]; }; [/code] if i try this [code] for(int s=0;s<size;s++) { root->a[s] = (kdiktis)malloc(sizeof(struct korifi)); root->a[s] = NULL; }[/code] …

Member Avatar for Duoas
0
163

The End.