Click here to Skip to main content
14,237,394 members
   

Java

 
GeneralRe: What database shoud i pick for my java app? Pin
Member 1413007929-Apr-19 10:02
memberMember 1413007929-Apr-19 10:02 
GeneralRe: What database shoud i pick for my java app? Pin
Maciej Los29-Apr-19 10:11
protectorMaciej Los29-Apr-19 10:11 
AnswerRe: What database shoud i pick for my java app? Pin
Gerry Schmitz29-Apr-19 15:23
mveGerry Schmitz29-Apr-19 15:23 
GeneralRe: What database shoud i pick for my java app? Pin
Richard MacCutchan29-Apr-19 21:16
protectorRichard MacCutchan29-Apr-19 21:16 
GeneralRe: What database shoud i pick for my java app? Pin
Dr.Walt Fair, PE5-May-19 7:42
professionalDr.Walt Fair, PE5-May-19 7:42 
AnswerRe: What database shoud i pick for my java app? Pin
Kelly Ferguson19-May-19 22:57
memberKelly Ferguson19-May-19 22:57 
AnswerRe: What database shoud i pick for my java app? Pin
remote4me21-Jun-19 2:40
memberremote4me21-Jun-19 2:40 
QuestionHow to add JMenu Pin
Member 1431822321-Apr-19 0:57
memberMember 1431822321-Apr-19 0:57 
//ConvexHull.java
 
package convexHull1;
 
import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
 
import javax.swing.JFrame;
 
public class ConvexHull extends Canvas implements MouseListener{
    private static int countA;
    private static int countB;
    private static ArrayList<Point> A = new ArrayList<Point>();
    private static ArrayList<Point> B = new ArrayList<Point>();
    private static Graphics gDC;
    public ConvexHull() {
        // TODO Auto-generated constructor stub
        countA = 0;
        countB = 0;
        addMouseListener((MouseListener) this);
    }
 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        JFrame jf = new JFrame("Convex Hull");
        ConvexHull convexHull = new ConvexHull();
        jf.setSize(800, 600);
        jf.setVisible(true);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.add(convexHull);
    }
 
    public void paint(Graphics gDC)
    {
        PrintWriter out;
        String str = new String();
        try {
            out = new PrintWriter(new BufferedWriter(new FileWriter("hulloutput.txt",true)));
        str = "";
        for(int i = 0;i < countA;i++)
        {
            gDC.fillOval(A.get(i).getX()-5, A.get(i).getY()-5, 10, 10);
            str += A.get(i).toString() + " ";
        }
        out.println("All points");
        out.println(str);
        out.println("Points on the hull");
        str = "";
        for(int i = 0;i < countB;i++)
        {
            gDC.drawLine(B.get(i).getX(),B.get(i).getY(), B.get((i+1)%countB).getX(),B.get((i+1)%countB).getY());
            System.out.println(B.get(i).getX() + " "+ B.get(i).getY());
            str += B.get(i).toString() + " ";
        }
        out.println(str);
        System.out.println();
        out.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
     
    @Override
    public void mouseClicked(MouseEvent e) {
        // TODO Auto-generated method stub
         
    }
 
    @Override
    public void mouseEntered(MouseEvent e) {
        // TODO Auto-generated method stub
         
    }
 
    @Override
    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub
         
    }
 
    @Override
    public void mousePressed(MouseEvent e) {
        // TODO Auto-generated method stub
        int x = e.getX();
        int y = e.getY();
        Point point = new Point(x,y);
        A.add(point);
        countA++;
        while(!B.isEmpty())
            B.remove(B.get(0));
        //Jarvis.Solve(A, B);
        //Graham.Solve(A, B);
        //QuickHull.Solve(A,B);
        countB = B.size();
        repaint();
    }
 
    @Override
    public void mouseReleased(MouseEvent e) {
        // TODO Auto-generated method stub
         
    }
 
}


How can I add JMenu to this and handle the events
AnswerRe: How to add JMenu Pin
Richard MacCutchan21-Apr-19 22:21
protectorRichard MacCutchan21-Apr-19 22:21 
Questionspeech recognition project in java for controlling your pc using voice java Pin
Member 1422299418-Apr-19 23:56
memberMember 1422299418-Apr-19 23:56 
AnswerRe: speech recognition project in java for controlling your pc using voice java Pin
Richard MacCutchan19-Apr-19 0:34
protectorRichard MacCutchan19-Apr-19 0:34 
Questiong.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 5:01
memberchandra12212-Apr-19 5:01 
QuestionRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 6:19
protectorRichard MacCutchan12-Apr-19 6:19 
AnswerRe: g.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 18:58
memberchandra12212-Apr-19 18:58 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 20:51
protectorRichard MacCutchan12-Apr-19 20:51 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 22:57
memberchandra12212-Apr-19 22:57 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 23:23
protectorRichard MacCutchan12-Apr-19 23:23 
QuestionPreview implementing 10 cross validation Pin
Member 142144734-Apr-19 22:41
memberMember 142144734-Apr-19 22:41 
QuestionGlobal variables are not supported in C# Pin
Brian_TheLion27-Mar-19 21:04
memberBrian_TheLion27-Mar-19 21:04 
AnswerRe: Global variables are not supported in C# Pin
Richard MacCutchan27-Mar-19 22:26
protectorRichard MacCutchan27-Mar-19 22:26 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion27-Mar-19 23:40
memberBrian_TheLion27-Mar-19 23:40 
GeneralRe: Global variables are not supported in C# Pin
Richard MacCutchan27-Mar-19 23:45
protectorRichard MacCutchan27-Mar-19 23:45 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion27-Mar-19 23:58
memberBrian_TheLion27-Mar-19 23:58 
GeneralRe: Global variables are not supported in C# Pin
Richard MacCutchan28-Mar-19 0:03
protectorRichard MacCutchan28-Mar-19 0:03 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion28-Mar-19 0:13
memberBrian_TheLion28-Mar-19 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.