LogoLogo
v7.0.0
v7.0.0
  • TotalCross Overview
  • TotalCross Javadoc
  • TotalCross Changelog
  • Roadmap
  • Documentation
    • Getting Started
      • First embedded project with TotalCross
    • Components
      • Accordion
      • Aligned Labels
      • Button
      • Check
      • ComboBox
      • Dynamic Scroll
      • Edit
      • Floating Button
      • Gpiod
      • Grid
      • GridContainer
      • Image
      • ImageControl
      • ImageList
      • Label
      • Material Icons
      • Material Window
      • MessageBox
      • Multi Edit
      • Progress Bar
      • Progress Box
      • Radio
      • Radio Group
      • Scroll Container
      • Side Menu
      • Slider
      • Sliding Window
      • Spin List
      • Spinner
      • Switch
      • Tabbed Container
      • Velocimeter
    • APIs
      • API Overview
      • API Rest
      • Asynchronous Task
      • Camera
      • Control
        • Main Window
        • Window
        • Container
      • GPS
      • HTTPS and SSL
      • JSON
      • Maps
        • Maps - Deprecated
        • Static Map
      • Material Design Standards
      • Ninepath
      • Notifications
      • PrinterManager
      • Push Notification Firebase
      • Scanner
      • SOAP
      • Socket
      • SocketServer
      • SQLite Encryption
      • QR Code Generator
      • totalcross.sys
      • Youtube API
    • Creating an Issue
    • Contributing
      • Branch workflow
      • Writing documentation
    • Guides
      • App Architecture
        • Suggested Architecture
        • Why do Design Patterns help with the application's organization?
          • MVC Architecture Pattern
          • Template Pattern
          • Data Persistence: DAO Pattern.
        • Separation of concepts: What is the best way to create UI interfaces?
        • Positioning
          • Manual Positioning
        • Relative Positioning
        • Best practices to improve project maintenance
      • Device Simulator
      • Package your app from scratch
        • TotalCross SDK
        • Environment Variables in IDE
          • Eclipse
          • IntelliJ
        • Deploy your app with a dependecy TC
        • Deploy iOS
          • Using Development certificate to test your apps
      • Understanding TotalCross for Linux ARM
      • Running C++ applications with TotalCross
      • Web Services
    • Miscelaneous
      • Java JDK 8
      • Maven
      • Installing Visual Studio Code
    • FAQ
      • IMEI in Android 10
Powered by GitBook
On this page
  • Overview
  • Usage
  • Features of Container
  • Method
  • Referencies

Was this helpful?

  1. Documentation
  2. APIs
  3. Control

Container

PreviousWindowNextGPS

Last updated 6 years ago

Was this helpful?

Overview

The container is a control that contains child controls. It is possible to adjust its transparency, screen transition effects, borders and background style.

If you want to know more about how differences between windows and container, how to navigate between interfaces and what are the best ways to handle containers and windows, just click on the link below:

Usage

Container
class ContainerSample extends Container{
	
	@Override
    public void initUI() {
      try {
            ImageControl logo = new ImageControl(new Image("path_of_your_logo_img"));
            logo.scaleToFit = true;
            logo.centerImage = true;
            logo.transparentBackground = true;
            add(logo, CENTER, CENTER, PARENTSIZE + 50, PARENTSIZE + 50);
        } catch (ImageException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Features of Container

  • Container characteristics are assigned to child controls

Method

Some methods that are most commonly used

name

Description

add(Control control, int x, int y, int w, int h, Control relative);

Adds the control on the screen where the parameter x is the positioning of the control in the container in relation to the x axis, the parameter y is the positioning of the control in the container in relation to the y axis, parameter w is the length of the component, parameter h represents the height of the component and the relative parameter is to change the reference of the control to add on the screen (by default the relative is the last control added).

setBackForeColors(Color back, Color fore)

Assigns the color of the back parameter to the container background and the color of the fore parameter to the forecolor of the container. It is interesting to remember that the children of the container inherit the characters of the same.

setBackColor(Color back);

Assigns the color of the back parameter to the container background

Referencies

( control)

add(Control control, int x, int y) ( control, int x, int y, relative) add(Control control, int x, int y, int w, int h)

You can see more information in

Separation of concepts: What is the best way to create UI interfaces?
How to navigate between screens
javaDoc
add
Control
add
Control
Control