Torna indietro   Hardware Upgrade Forum > Software > Programmazione

iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
C'è tanta sostanza nel nuovo smartphone della Mela dedicato ai creator digitali. Nuovo telaio in alluminio, sistema di raffreddamento vapor chamber e tre fotocamere da 48 megapixel: non è un semplice smartphone, ma uno studio di produzione digitale on-the-go
Intel Panther Lake: i processori per i notebook del 2026
Intel Panther Lake: i processori per i notebook del 2026
Panther Lake è il nome in codice della prossima generazione di processori Intel Core Ultra, che vedremo al debutto da inizio 2026 nei notebook e nei sistemi desktop più compatti. Nuovi core, nuove GPU e soprattutto una struttura a tile che vede per la prima volta l'utilizzo della tecnologia produttiva Intel 18A: tanta potenza in più, ma senza perdere in efficienza
Intel Xeon 6+: è tempo di Clearwater Forest
Intel Xeon 6+: è tempo di Clearwater Forest
Intel ha annunciato la prossima generazione di processori Xeon dotati di E-Core, quelli per la massima efficienza energetica e densità di elaborazione. Grazie al processo produttivo Intel 18A, i core passano a un massimo di 288 per ogni socket, con aumento della potenza di calcolo e dell'efficienza complessiva.
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 30-11-2012, 18:48   #1
liulca
Junior Member
 
Iscritto dal: Nov 2012
Messaggi: 1
java problema disegna poligoni

salve a tutti mi servirebbe un aiuto devo disegnare 4 diversi poligoni ho scritto il codice seguenta ma mi disegna un solo poligono è possibile trovare una soluzione vi ringrazio anticipatamente.

import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Polygon;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Polygons1 extends JPanel {

@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);


Set<POINTS> POLYGON = new LinkedHashSet<POINTS>();


//polygon 1 point 3
POLYGON.add(new POINTS(1, 50, 20));
POLYGON.add(new POINTS(1, 70, 30));
POLYGON.add(new POINTS(1, 50, 40));


//polygon 2 point 4
POLYGON.add(new POINTS(2, 100, 20));
POLYGON.add(new POINTS(2, 130, 30));
POLYGON.add(new POINTS(2, 100, 40));
POLYGON.add(new POINTS(2, 120, 30));


//polygon 3 point 6
POLYGON.add(new POINTS(3, 150, 20));
POLYGON.add(new POINTS(3, 180, 30));
POLYGON.add(new POINTS(3, 150, 40));
POLYGON.add(new POINTS(3, 130, 20));
POLYGON.add(new POINTS(3, 180, 30));
POLYGON.add(new POINTS(3, 150, 50));


//polygon 4 point 12
POLYGON.add(new POINTS(4, 150, 20));
POLYGON.add(new POINTS(4, 180, 30));
POLYGON.add(new POINTS(4, 150, 40));
POLYGON.add(new POINTS(4, 130, 20));
POLYGON.add(new POINTS(4, 180, 30));
POLYGON.add(new POINTS(4, 150, 50));
POLYGON.add(new POINTS(4, 150, 20));
POLYGON.add(new POINTS(4, 180, 30));
POLYGON.add(new POINTS(4, 130, 60));
POLYGON.add(new POINTS(4, 140, 50));
POLYGON.add(new POINTS(4, 140, 30));
POLYGON.add(new POINTS(4, 120, 30));







int n = POLYGON.size() ;
int[] x = new int[n];
int[] y = new int[n];
int counter = 0;

for (POINTS pnt : POLYGON) {
x[counter] = pnt.getX();
y[counter++] = pnt.getY();

System.out.println(x);


Polygon[] polygons = new Polygon[4];
for (int i = 0; i < polygons.length; i++) {
polygons[i] = new Polygon();
polygons[pnt.getID()-1] = new Polygon(x, y, x.length);
g.setColor(Color.RED);
g.drawPolygon(polygons[i]);
}} }





public class POINTS {

private int ID;
private int X;
private int Y;

public POINTS(
int ID, int X, int Y) {
this.ID = ID;
this.X = X;
this.Y = Y;
}

public int getX() {
return X;
}

public int getY() {
return Y;
}

public int getID() {
return ID;
}
}

public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setTitle("Polygons");
frame.setSize(550, 550);
frame.addWindowListener(new WindowAdapter() {

@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Container contentPane = frame.getContentPane();
contentPane.add(new Polygons1());

frame.show();
}
}
liulca è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile iPhone 17 Pro: più di uno smartphone. &Eg...
Intel Panther Lake: i processori per i notebook del 2026 Intel Panther Lake: i processori per i notebook ...
Intel Xeon 6+: è tempo di Clearwater Forest Intel Xeon 6+: è tempo di Clearwater Fore...
4K a 160Hz o Full HD a 320Hz? Titan Army P2712V, a un prezzo molto basso 4K a 160Hz o Full HD a 320Hz? Titan Army P2712V,...
Recensione Google Pixel Watch 4: basta sollevarlo e si ha Gemini sempre al polso Recensione Google Pixel Watch 4: basta sollevarl...
Le sonde spaziali ESA ExoMars e Mars Exp...
Roscosmos: static fire per i propulsori ...
Alcune partite NBA saranno trasmesse in ...
Intel Core 13000 e 14000 aumentano uffic...
Gemini sta per arrivare in Google Maps: ...
2 minuti per vedere le 27 offerte imperd...
Ray-Ban Meta Display: tecnologia sorpren...
Un mini PC a prezzo stracciato, non cerc...
Al via i coupon nascosti di ottobre: qua...
Ferrari Elettrica si aggiorna solo in of...
Doppio sconto sugli smartphone top Xiaom...
Samsung è sempre più prota...
ChatGPT ha pregiudizi politici? Ecco cos...
Un solo iPhone rubato ha portato alla sc...
Xiaomi 17 Ultra sta arrivando: ecco come...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 04:10.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v