im new at java gui, any suggestion to make those image to have smoother edges…
i read alike problems but I couldnt grasp how can I correlate it to my situation…
images has not so good edges
ps. the custom panel class ask for Color color, int x position, int y position, int layoutManager, and ImageIcon…
for (int i = 0; i < 8; i++){
playlist[i] = new Panel(new Color(110, 110, 110, 50), 0, 0, null, data.recently_clicked_non_artist.get(i).getImageAsRecentlyPlayed()){
@Override
protected void paintComponent(Graphics g){
super.paintComponent(g);
Dimension arcs = new Dimension(arc, arc);
int width = getWidth();
int height = getHeight();
Graphics2D g2d = (Graphics2D)g;
g2d.setClip(0, 0, getWidth(), getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//Draws the rounded opaque panel with borders
g2d.setColor(getBackground());
g2d.fillRoundRect(0, 0, width-1, height-1, arcs.width, arcs.height);
g2d.setColor(Color.RED);
// g2d.fillRoundRect(0, 0, 50, height-1, arcs.width, arcs.height);
g2d.setClip(new RoundRectangle2D.Float(0, 0, 50, getHeight(), arcs.width, arcs.height));
g2d.drawImage(getImageIcon().getImage(), 0, 0, 50, getHeight(), null);
}
};
playlist[i].setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
subTopPanel.add(playlist[i]);
I tried putting g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); but it doesnt seem to help me…
Insanity Gaming is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1