> For the complete documentation index, see [llms.txt](https://educacion.gitbook.io/programacion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://educacion.gitbook.io/programacion/ud5-entrada-e-saida-da-informacion/interfaces-graficas/auxiliares.md).

# Auxiliares

Neste apartado falamos de clases auxiliares que van a facilitar a nosa implementación das interfaces:

## Dimension

`Dimension` en Swing é unha **clase que representa un tamaño (ancho e alto) en píxeles**.

* Úsase principalmente cos **componentes gráficos** para indicar:
  * **`setPreferredSize(Dimension d)`** → tamaño preferido
  * **`setMinimumSize(Dimension d)`** → tamaño mínimo
  * **`setMaximumSize(Dimension d)`** → tamaño máximo

{% hint style="info" %}
**Documentación oficial:** <https://docs.oracle.com/javase/8/docs/api/java/awt/Dimension.html>
{% endhint %}

```java
JPanel panel = new JPanel();
panel.setPreferredSize(new Dimension(300, 100));
```

## Border

`Border` é unha **interface de Swing** que define un **borde ou marco decorativo** arredor dun compoñente (`JPanel`, `JLabel`, etc.).

* Pode ser **visible** (liñas, relevo, títulos) ou **invisible** (soamente padding).
* Exemplos de bordes: `LineBorder`, `BevelBorder`, `TitledBorder`, etc.

{% hint style="info" %}
**Documentación oficial:** <https://docs.oracle.com/javase/8/docs/api/javax/swing/border/Border.html>
{% endhint %}

## BorderFactory

`BorderFactory` é unha **clase de utilidade** que crea instancias de `Border` de forma sinxela.

* Nunca se instancian bordes directamente; sempre se usan os métodos estáticos de `BorderFactory`.
* Permite crear todo tipo de bordes: liñas, relevo, compostos, con títulos, etc.

{% hint style="info" %}
**Documentación oficial:** <https://docs.oracle.com/javase/8/docs/api/javax/swing/BorderFactory.html>
{% endhint %}

```java
JPanel panel = new JPanel();
Border marginBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
Border lineBorder = BorderFactory.createLineBorder(Color.DARK_GRAY, 4);
panel.setBorder(BorderFactory.createCompoundBorder(lineBorder, marginBorder));
```

## ImageIO

É unha **clase utilitaria de Java** que permite **ler e escribir imaxes** en diferentes formatos (`PNG`, `JPG`, `GIF`, etc.).

No noso caso imos a empregala unicamente para lectura mediante un metodo read que recibe un obxecto File

{% hint style="info" %}
Documentación oficial: <https://docs.oracle.com/javase/8/docs/api/javax/imageio/ImageIO.html>
{% endhint %}

## Image

Clase que representa unha imaxe.

{% hint style="info" %}
Doucmenatción oficial: <https://docs.oracle.com/javase/8/docs/api/java/awt/Image.html>
{% endhint %}

```java
Image imagenLeida = ImageIO.read(new File("C://Usuarios//...//Imagen.png"));
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://educacion.gitbook.io/programacion/ud5-entrada-e-saida-da-informacion/interfaces-graficas/auxiliares.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
