All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.alantea.swing.graph.GraphLabeledContainer Maven / Gradle / Ivy

The newest version!
package net.alantea.swing.graph;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JLabel;
import javax.swing.SwingConstants;

@SuppressWarnings("serial")
public class GraphLabeledContainer extends GraphElement
{
   JLabel label;
   GraphElement content;
   
   public GraphLabeledContainer()
   {
      setLayout(new BorderLayout(0, 5));
      label = new JLabel();
      super.add(label, BorderLayout.NORTH);
      label.setBackground(Color.YELLOW);
      label.setOpaque(true);
      label.setText("Toto");
      label.setPreferredSize(new Dimension(1, 25));
      label.setHorizontalAlignment(SwingConstants.CENTER);
      
      content = new GraphElement();
      super.add(content, BorderLayout.CENTER);
   }
   
   public void add(Component component, Object constraints)
   {
      content.add(component, constraints);
   }
   
   
   public void paintBorder(Graphics g)
   {
      drawRoundRectangle(g, Color.YELLOW, 0.0, 0.0, 1.0, 1.0, 3, 10);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy