import javax.swing.*;
public class FirstSwingExample {
public static void main(String[] args) {
JFrame f=new JFrame();//creating instance of JFrame
JButton b=new JButton("click");//creating instance of JButton
b.setBounds(130,100,100, 40);//x axis, y axis, width, height
f.add(b);//adding button in JFrame
f.setSize(400,500);//400 width and 500 height
f.setLayout(null);//using no layout managers
f.setVisible(true);//making the frame visible
}
}
Multiplier
CSS custom properties are excellent when it comes to updating multiple elements at once. By injecting a --text-multiplier variable into the text elements' size, you can increase/decrease them all at a specific breakpoint by editing the variable.
// Method 3
h1 {
font-size: calc(2em * var(--text-multiplier, 1));
}
p {
font-size: calc(1em * var(--text-multiplier, 1));
}
@media (min-width: 48rem) {
:root {
--text-multiplier: 1.25;
}
}
<style>
body {
margin: 1em auto;
max-width: 40em;
width: 88%;
}
/* The CSS aspect-ratio property tells browsers to preserve a specific aspect ratio on an element when scaling the size of it up or down. */
iframe {
width: 100%;
height: 100%;
aspect-ratio: 16 / 9;
}
</style>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/_VDGysJGNoI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
/*__Responsive Media Queries __*/
/* Mobile & Small devices */
@media only screen and (max-width: 480px) {...}
/* Portrait Tablets and Ipads devices) */
@media only screen and (max-width: 768px) {...}
/* Laptops and Small screens */
@media only screen and (max-width: 1024px) {...}
/* Laptops, Desktops Large devices */
@media only screen and (max-width: 1280px) {...}
/* Extra large devices (large laptops and desktops) */
@media only screen and (min-width: 1281px) {...}
Comments