java

Tags:  •  

Almost all beginner Java Swing programmers meet these issues. I have written some code example for representing the solution. This issue collection is useful for some situation, but please comment it.

Maximize a Java Frame

How to maximize the JFrame (main window) from code:

import java.swing.JFrame;
 
public class MyFrame extend JFrame {
   public MyFrame() {
     // the application window is run as maximized
     this.maximize();
 
     // some code ...
   }
 
   /**
    * Maximize the Frame.
    */
   public void maximize() {
Tags:  •  

This is a short summary of Sun's Java naming conventions.
I think the most important code convention in Java is the naming convention. These easy naming conventions make programs more understandable by making them easier to read.

Naming conventions

Classes and interfaces
Class and interface names should be nouns, in mixed case with the first letter of each internal word capitalized.

Tags:  •    •    •    •  

I found an interest math problem Bertrand's paradox. This problem was originally posed by Joseph Bertrand in his work.

The Problem

Determine the probability that a random chord of a circle of unit radius has a length greater than the square root of 3, the side of an inscribed equilateral triangle.

Experiment simulation

I've modeled this problem with 3 java classes (Circle, Point, Main). The Main class does the experiment with other 2 classes. The main problem in this paradox is the random chord definition. What do we mean under random chord? I try to implement the problem in the way that I select both chords of circle object randomly.