This paper addresses a swing-up and stabilizing problem for a cart-pendulum system, which consists of a pendulum and a motor-driven cart. Existing methods are based on the strategy of swing-up of the pendulum by energy control methods, then switching the controllers to balance the pendulum when it approaches the upright position. The switching angle influences significantly control performance, so the pendulum might fall down if the angle is inadequately chosen. This paper proposes a swing-up and stabilizing control method which makes it possible to determine an appropriate switching angle more arbitrarily. In addition to the energy control method for swing-up, a stabilizing method based on controlled Lagrangians is adopted instead of a linear controller. The attractive domain of the closed-loop system with this method can be known in advance and is wider than with linear controllers. In this way, our proposed control strategy overcomes the difficulty in choosing the switching angle of the controllers. An experimental result illustrates the effectiveness of the proposed method.